PDA

View Full Version : MultiVendor Core modification



Wise
13-01-13, 03:18 AM
Images
http://imageshack.us/a/img248/2091/h...f9ghjh7as6.png (http://imageshack.us/a/img248/2091/hash87gf67h8gf9ghjh7as6.png)
http://imageshack.us/a/img844/2531/h...65s8f54h9g.png (http://imageshack.us/a/img844/2531/hashf8g765s8f54h9g.png)
http://imageshack.us/a/img713/2800/h...fdgh96jg6h.png (http://imageshack.us/a/img713/2800/hashdf8g768fdgh96jg6h.png)


Hello.
Someone had some problems with Evilfairy's script, so I took a look at it and decided to make my own.
In contrast to the "not core mod", "not database" idea, I decided to make this script editable through database and made it a core modification so I could just tweak the base gossip system slightly.

This modification allows multi vendors to be edited and created totally through database.

Everything you need to do is to make the NPC a vendor (have NPCFLAG 128 + gossip NPCFLAG 1)
then you need to make some gossip items for him that trigger the vendors.

You can use normal SAI scripts and other gossip options through database as well
(you can add multiple vendors to your SQL teleporter etc.)

This script does not add new database tables or columns!

Supported TC version: 161caf860b3aece9b81d1f733018b752e7f5ce44
Download diff: [Diff] Multi Vendor - Pastebin.com (http://pastebin.com/8jkFpN9m)

Installation:

Apply the diff and recompile
Then use database tables to create multi vendors
Explanation:

NPC needs NPCflag 129
Then you pick an unused menu_id from gossip_menu_option table and put it to gossip_menu_id field for your NPC.
Then you create your options.
The options need to have the same menu_id as your NPC had in gossip_menu_id
Important things to know:

Multi vendor gossip options are exactly the same as normal vendor gossip options, but the action_menu_id defines which vendor entry from npc_vendor to show.
option_id = 3 // defines the option to be a vendor
npc_option_npcflag = 128 // requires the NPC to have vendor flags to see the option
action_menu_id is the entry of the vendor shown from npc_vendor

Example NPC: (uses menu_id 22000 by default)





INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (700001, 1298, "Herbert", "MultiVendor", NULL, 22000, 10, 10, 0, 35, 35, 129, 1, 1.14286, 1, 0, 13, 17, 0, 42, 1, 1500, 0, 1, 512, 2048, 8, 0, 0, 0, 0, 0, 9, 13, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 2, '', 12340);





Example vendors/options:




INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES (22000, 0, 4, 'VendorTest 1', 3, 128, 465, 0, 0, 0, ''), (22000, 1, 9, 'VendorTest 2', 3, 128, 54, 0, 0, 0, ''), (22000, 2, 6, 'VendorTest 3', 3, 128, 35574, 0, 0, 100, 'These goods are special, so pay up!');




http://imageshack.us/scaled/medium/844/hashf8g765s8f54h9g.png (http://imageshack.us/photo/my-images/844/hashf8g765s8f54h9g.png/)
http://imageshack.us/scaled/medium/248/hash87gf67h8gf9ghjh7as6.png (http://imageshack.us/photo/my-images/248/hash87gf67h8gf9ghjh7as6.png/)


Credits:
script - Rochet2
NPC and special thanks - Evilfairy (checked out her script)