Jump to content

[HELP] Skill Upgrader NPC


Recommended Posts

Posted

So I was thinking of making a NPC that would raise all your skills, except for your profession ones, to their maximum level.

Now there are no errors except for when the whole process is done. The following errors appear:

1>   Creating library ..\\..\\..\\..\\bin\\win32_release/MaNGOSScript.lib and object ..\\..\\..\\..\\bin\\win32_release/MaNGOSScript.exp

1>weaponmaster_ai.obj : error LNK2001: unresolved external symbol "class DBCStorage<struct SkillLineEntry> sSkillLineStore" (?sSkillLineStore@@3V?$DBCStorage@USkillLineEntry@@@@A)

1>..\\..\\..\\..\\bin\\win32_release/MaNGOSScript.dll : fatal error LNK1120: 1 unresolved externals

And here is the full script:

// WEAPON MASTER

#include "precompiled.h"
#include "sharedDefines.h"
#include <cstring>

#define     GOSSIP_ITEM_1       "Maximize my skills, please."

bool WeaponMasterHello(Player* pPlayer, Creature* pCreature)
{
   pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF, "", 0, true);

   pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID());
   return true;
}


bool WeaponMasterSkill(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode)
{
   if (uiSender == GOSSIP_SENDER_MAIN)
   {
       //SkillLineEntry const *targetSkillInfo = NULL;
       switch (uiAction)
       {
           case GOSSIP_ACTION_INFO_DEF:
           {
               for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i)
               {
                   SkillLineEntry const *skillInfo = NULL;
                   skillInfo = sSkillLineStore.LookupEntry(i);

                   if (!skillInfo)
                       continue;

                   if (skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || 
                       skillInfo->categoryId == SKILL_CATEGORY_SECONDARY)
                       continue;

                   uint16 maxLevel = pPlayer->GetPureMaxSkillValue(skillInfo->id);
                   pPlayer->SetSkill(skillInfo->id, maxLevel, maxLevel);
               }

               return true;
           }
       }
   }

   return false;
}

void AddSC_Weaponmaster_AI()
{
   Script* newscript;

   newscript = new Script;
   newscript->Name = "weaponmaster_ai";
   newscript->pGossipHello = &WeaponMasterHello;
   newscript->pGossipSelectWithCode = &WeaponMasterSkill;
   newscript->RegisterSelf();
}

So what is wrong with the script? Did I forget some header(s)? Is there another way?

Thanks in advance :)

Posted

Look in mangosd.conf

# AlwaysMaxSkillForLevel

# Players will automatically gain max level dependent (weapon/defense) skill when logging in, leveling up etc.

# Default: 0 (false)

# 1 (true)

Posted

Scripts do not have access to sSkillLineStore. To do this, you need to modify the core. Find these lines at the bottom of DBCStores.h:

// script support functions
MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry>          const* GetSoundEntriesStore();
MANGOS_DLL_SPEC DBCStorage <SpellEntry>                 const* GetSpellStore();
MANGOS_DLL_SPEC DBCStorage <SpellRangeEntry>            const* GetSpellRangeStore();
MANGOS_DLL_SPEC DBCStorage <FactionEntry>               const* GetFactionStore();
MANGOS_DLL_SPEC DBCStorage <ItemEntry>                  const* GetItemDisplayStore();
MANGOS_DLL_SPEC DBCStorage <CreatureDisplayInfoEntry>   const* GetCreatureDisplayStore();
MANGOS_DLL_SPEC DBCStorage <EmotesEntry>                const* GetEmotesStore();
MANGOS_DLL_SPEC DBCStorage <EmotesTextEntry>            const* GetEmotesTextStore();

At the bottom add

MANGOS_DLL_SPEC DBCStorage <SkillLineEntry> const* GetSkillLineStore();

And use this function instead of sSkillLineStore.

Posted
Look in mangosd.conf

# AlwaysMaxSkillForLevel

# Players will automatically gain max level dependent (weapon/defense) skill when logging in, leveling up etc.

# Default: 0 (false)

# 1 (true)

This was mainly for developing, scripting learning purpose. But thanks :)

@Patman128

Will look into that! Cheers!

  • 2 weeks later...
Posted

I'm getting the same errors with

const CharTitlesEntry* titleInfo = sCharTitlesStore.LookUpEntry(id);

now, and I have no idea how to fix it with modifying the core. I tried to do something similair to what Patman128 said, but that did not quite work out.

Posted
why don't you just use this function ?

pPlayer->UpdateSkillsToMaxSkillsForLevel();

The issue of skillupgrading has been fixed, but I have a similar problem which I posted earlier.

Not sure if I have to start another thread, as it's basicly the same problem.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use