Description:
The innkeeper cannot display zhCN. I added zhCN records to gossip_menu_option_locale but it didn't work. I found that 4 locales had been written to npc_innkeeper.cpp and never load from database.
Expected behaviour:
Display zhCN currently.
Steps to reproduce the problem:
Use a zhCN client and find a innkeeper such as creature_template entry 9501, then it just display English.
Branch(es):
3.3.5
I find that if I set creature_template.ScriptName to empty string, it will display correctly. What's the difference between them?
The innkeeper script only supports 4 languages:
I don't remember how much work is needed to get rid of that old script and use DB linking instead.
This is why scripts are linked to quest id or gossip id, not to creature. Currently to use all locales and original gossip menus we need to create 150 scripts for creatures instead of 15 gossip scripts linked to gossip id.
This is exactly why they constantly duplicates similar objects and quests, because they holds unique scripts.
Moving everything to one system was not a good idea. However we still can implement new source type for gossips.
We need to use broadcast texts directly from table for gossip menu options in such scripts. When our scripts will be tied directly to gossip options, we will be able to properly convert all inkeepers to DB
It's needed also in npc_professions.cpp because this thing is not convertable to DB due to lack of info & really big amount of stuff to duplicate(each gossip menu and its conditions needs to be duplicated multiple times), the best we can do in this case now is use texts directly from table and update all those scripts
Thanks for pointing out those details. I usually forget about those details, unless I start looking into what it takes to convert those scripts, because it is quite a mess.
@offl gossip_menu_option has a OptionBroadcastTextId
so you should be able to use a gossip menu option with broadcast text?
Although I couldn't find any entry with 'trick or treast' in BroadcastText.
Regarding making this script into db: I think with some enhancement to the SAI system we can make it.
Specifically:
gossip_menu_option
(vendor + bind hs)The feature that is missing here is the condition on template (3.2). Without it, we'll need to create a condition for each creature.
Assuming we have all of that, to update a single npc we'll need:
While it still means we need to create a script for each npc, updating the inn script will only be updated in a single place.
What do you think?
p.s.
While a lot more complicated, I'm pretty sure the same idea can be applied to npc_professions.cpp
.
Edit:
Actually a better idea would be to implement the templates in the db with a new script type, SMART_SCRIPT_TYPE_TEMPLATE.
That way the conditions could easily be applied to it as well.
Make a smart script template that will:
3.1. add 2 events with on_gossip_hello and send_gossip_menu (1 for each menu).
gossip_menu_options have support for conditions, visibility of actions should be handled there. Manual send_gossip_menu
shouldn’t be used.
And multiple npcs can have same gossip_menu with options, so this is not missing. However, it would still be required to copy same smart actions among multiple npcs as they can’t be shared/templated, so what you propose still is helpful.
Or SMART_SCRIPT_TYPE_GOSSIP source would be also neat for such usecase.
We need to use broadcast texts directly from table for gossip menu options in such scripts.
Spent like 5 minutes to figure out what I meant, lol. I meant temp C++ solution to send text id instead of texts defined in C++.
AddGossipItemFor(player, GOSSIP_ICON_CHAT, BROADCAST_TEXT_TRICK_OR_TREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
C++ GossipHello overrides stored in DB options but probably we can define all gossip menu options ids in the script without overriding them. So in GossipSelect we'll have stored in DB options and we can add effects to each of them.
But should we? It's supposed to be simple 15 rows of SMART_SCRIPT_TYPE_GOSSIP and 15 conditions in DB. It's just perfect case to explain why scripts are linked to gossip menu entries. There are just 15 gossip ids linked to 150 NPCs, it looks reasonable to make only 15 scripts instead of 150.
Actually a better idea would be to implement the templates in the db with a new script type, SMART_SCRIPT_TYPE_TEMPLATE.
That way the conditions could easily be applied to it as well.
Yes, we need it. However I don't have right now a clear explanation how exactly we need to use them and how they should look like.
Regarding making this script into db: I think with some enhancement to the SAI system we can make it.
Specifically:
- Have the generic gossip menu items in
gossip_menu_option
(vendor + bind hs)- Have another gossip menu with the same items + trick or treat (hence 2 menus)
- Make a smart script template that will:
3.1. add 2 events with on_gossip_hello and send_gossip_menu (1 for each menu).
3.2. Add a condition to each event to only send one when the trick or treat aura is active/notThe feature that is missing here is the condition on template (3.2). Without it, we'll need to create a condition for each creature.
Assuming we have all of that, to update a single npc we'll need:
- Update the creature_template to set AIName to SmartAI
- Add a single entry for that npc to install the predefined smart script template we created
While it still means we need to create a script for each npc, updating the inn script will only be updated in a single place.
What do you think?
To be honest looks more complex than 15 SMART_SCRIPT_TYPE_GOSSIP + 15 conditions to show gossip only if event is active + 1 SMART_SCRIPT_TYPE_TEMPLATE linked to all 15 SMART_SCRIPT_TYPE_GOSSIP.
Thing is all or nearly all gossip options should be handled by SMART_SCRIPT_TYPE_GOSSIP, because it's ridiculous to handle them in main script(so for quests).
Previously there were multiple db scripts templates to link scripts directly to quests, objects, spells(still exists but outdated as hell), event ids(still exists and outdated).
They all were removed and replaced by SAI but now it looks like we should turn back to them.
To be honest looks more complex than 15 SMART_SCRIPT_TYPE_GOSSIP + 15 conditions to show gossip only if event is active + 1 SMART_SCRIPT_TYPE_TEMPLATE linked to all 15 SMART_SCRIPT_TYPE_GOSSIP.
Thing is all or nearly all gossip options should be handled by SMART_SCRIPT_TYPE_GOSSIP, because it's ridiculous to handle them in main script(so for quests).
Previously there were multiple db scripts templates to link scripts directly to quests, objects, spells(still exists but outdated as hell), event ids(still exists and outdated).
They all were removed and replaced by SAI but now it looks like we should turn back to them.
Although I couldn't find any entry with 'trick or treast' in BroadcastText.
@matanshukry : I am not sure what kind of query you have tested, but I find it practical to use something like this:
SELECT * FROM `broadcast_text` WHERE `Text` LIKE "%trick or treat%";
(Note my use of %
and " " in the search text.)
ID LanguageID Text Text1 EmoteID1 EmoteID2 EmoteID3 EmoteDelay1 EmoteDelay2 EmoteDelay3 SoundEntriesID EmotesID Flags VerifiedBuild
----- ---------- ------------------------------------- ------------------------------------- -------- -------- -------- ----------- ----------- ----------- -------------- -------- ------ -------------
10693 0 Trick or Treat! Trick or Treat! 0 0 0 0 0 0 0 0 1 18019
23286 0 We should go trick or treating later. We should go trick or treating later. 0 0 0 0 0 0 0 0 1 18019
24331 1 We should go trick or treating later. We should go trick or treating later. 0 0 0 0 0 0 0 0 1 18019
24348 7 We should go trick or treating later. We should go trick or treating later. 0 0 0 0 0 0 0 0 1 18019
(This is from TDB 335.21021 )
SELECT * FROM `broadcast_text` WHERE `Text` LIKE "%trick or treat%";
I actually checked the https://wow.tools/dbc/?dbc=broadcasttext&build=9.0.5.37705&hotfixes=true#page=1 , I forgot about the local table.