talamortis / OregonCore

World of Warcraft 2.4.3 Server Emulator
GNU General Public License v2.0
69 stars 51 forks source link

npc gossip icon #236

Closed turbosnek closed 3 years ago

turbosnek commented 3 years ago

Please, I made npc_gossip script but in the game not show gossip icon on npc

include "ScriptMgr.h"

include "Spell.h"

include "SpellAuraDefines.h"

include "SpellAuras.h"

include "SpellMgr.h"

include "ScriptedCreature.h"

define STAMINA 39231

define MANA 27127

define BOK 25898

define BOM 27141

define BOW 27143

define BOS 25895

define PACKA 39233

define SPIRIT 39234

class npc_buffer : public CreatureScript { public: npc_buffer() : CreatureScript("npc_buffer") {}

    bool OnGossipHello(Player* player, Creature* pcreature)
    {
        player->ADD_GOSSIP_ITEM(0, "Stamina", GOSSIP_SENDER_MAIN, 1);
        player->ADD_GOSSIP_ITEM(0, "Mana", GOSSIP_SENDER_MAIN, 2);
        player->ADD_GOSSIP_ITEM(0, "Greater Blessing of Kings", GOSSIP_SENDER_MAIN, 3);
        player->ADD_GOSSIP_ITEM(0, "Greater Blessing of Might", GOSSIP_SENDER_MAIN, 4);
        player->ADD_GOSSIP_ITEM(0, "Greater Blessing of Wisdom", GOSSIP_SENDER_MAIN, 5);
        player->ADD_GOSSIP_ITEM(0, "Greater Blessing of Salvation", GOSSIP_SENDER_MAIN, 6);
        player->ADD_GOSSIP_ITEM(0, "Mark of the Wild", GOSSIP_SENDER_MAIN, 7);
        player->ADD_GOSSIP_ITEM(0, "Spirit", GOSSIP_SENDER_MAIN, 8);
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pcreature->GetGUID());
        return true;
    }

    bool OnGossipSelect(Player* player, Creature* pcreature, uint32 sender, uint32 uiAction)
    {
        if (!player)
             return false;

        player->PlayerTalkClass->ClearMenus();

        switch (uiAction)
        {
        // Stamina
        case 1:
            pcreature->CastSpell(player, STAMINA, false);
            player->CLOSE_GOSSIP_MENU();
            break;
        }

    }

};

void AddSC_npc_buffer() { new npc_buffer(); }

INSERT INTOworld.creature_template(entry,heroic_entry,KillCredit1,KillCredit2,modelid1,modelid2,modelid3,modelid4,name,subname,IconName,gossip_menu_id,minlevel,maxlevel,exp,minhealth,maxhealth,minmana,maxmana,armor,faction,npcflag,speed_walk,speed_run,scale,rank,dmgschool,BaseAttackTime,RangeAttackTime,BaseVariance,RangeVariance,unit_class,unit_flags,dynamicflags,family,trainer_type,trainer_spell,class,race,type,type_flags,lootid,pickpocketloot,skinloot,resistance1,resistance2,resistance3,resistance4,resistance5,resistance6,spell1,spell2,spell3,spell4,PetSpellDataId,mingold,maxgold,AIName,MovementType,InhabitType,HealthModifier,ManaModifier,ArmorModifier,DamageModifier,RacialLeader,RegenHealth,equipment_id,mechanic_immune_mask,flags_extra,ScriptName) VALUES (80000, 0, 0, 0, 18921, 0, 18921, 0, 'Buffer', 'Snecek Develop', NULL, 0, 71, 71, 1, 7500, 7500, 21996, 21996, 0, 35, 1, 1.48, 1.14286, 1, 1, 0, 2000, 0, 1, 1, 8, 33024, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1.49194, 3, 0, 1.24279, 0, 1, 1445, 0, 2, 'npc_buffer');

milestorme commented 3 years ago

not really a core issue but perhaps this working module will help you https://github.com/talamortis/OregonCore-Modules/tree/master/modules_scripts/mod-BuffNPC

turbosnek commented 3 years ago

https://imagizer.imageshack.com/img922/8964/t3cmrn.png

My problem is. After mouseover to npc there is no gossip icon.

turbosnek commented 3 years ago

I am noob. Missing {} in case and missing return true after switch action :D. Close