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

feat(Core/Player): SendListInventory with vendor id #48

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

noisiver
Copy link

Updated SendListInventory to allow specifying which vendor entry to send to the player.

Tested with a creature template entry of 9000000 with 129 set as npcflag and with a npc_vendor entry. The first option opens the vendor offered by the stormwind innkeeper while the second one defaults to the creature you're talking to.

local function VendorOnGossipHello(event, player, object)
    player:GossipClearMenu()
    player:GossipMenuAddItem(7, "I want something", 1, 100)
    player:GossipMenuAddItem(7, "I want something else", 1, 200)
    player:GossipSendMenu(0x7FFFFFFF, object, 1)
end

local function VendorOnGossipSelect(event, player, object, sender, intid, code, menu_id)
    if (intid == 100) then
        player:SendListInventory(object, 6740) -- entry 6740 from npc_vendor
    elseif (intid == 200) then
        player:SendListInventory(object) -- defaults to creature entry from npc_vendor
    end
end

RegisterCreatureGossipEvent(9000000, 1, VendorOnGossipHello)
RegisterCreatureGossipEvent(9000000, 2, VendorOnGossipSelect)

All credit goes to Foe on Discord, whichever username that may be on Github.

@noisiver noisiver changed the title feature: SendListInventory with vendor id feat(Core/Player): SendListInventory with vendor id Jun 26, 2022
@55Honey
Copy link
Member

55Honey commented Jun 27, 2022

Once again, thanks @Foereaper for the support and thanks @tkn963 for submitting the PR.

@55Honey
Copy link
Member

55Honey commented Jul 5, 2022

Tested with a creature template entry of 9000000 with 129 set as npcflag and with a npc_vendor entry.

I'm about to test things. Do you have the sql for the creature 9000000 at hand?

@noisiver
Copy link
Author

noisiver commented Jul 5, 2022

I used this one:

SET
@Entry := 9000000,
@Model := 27822,
@Name  := "Gabriella",
@Title := "The Assistant",
@Icon  := "Speak",
@GossipMenu := 0,
@MinLevel := 30,
@MaxLevel := 30,
@Faction  := 35,
@NPCFlag  := 129,
@Scale    := 1.0,
@Rank     := 0,
@Type     := 7,
@TypeFlags := 0,
@FlagsExtra := 16777218,
@Script     := "";

-- Creature template
DELETE FROM `creature_template` WHERE `entry`=@Entry;
INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `unit_class`, `unit_flags`, `type`, `type_flags`, `RegenHealth`, `flags_extra`, `ScriptName`) VALUES
(@Entry, @Model, @Name, @Title, @Icon, @GossipMenu, @MinLevel, @MaxLevel, @Faction, @NPCFlag, 1, 1, @Scale, @Rank, 1, 2, @Type, @TypeFlags, 1, @FlagsExtra, @Script);

@55Honey
Copy link
Member

55Honey commented Jul 5, 2022

Tested, works like a charm. This is a huge improvement actually.

@55Honey 55Honey merged commit 0b8b6c0 into azerothcore:master Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants