Dress NPCs

wow model viewer

It shows item entries and display IDs, so you can just grab the display from there and use for the script.

nice, cheers. also great patch /emoticons/default_wink.png

You make some pretty cool things, Rochet2

Updated.

Also added the suggestion by Sigmur.

I’m trying to get Rotchet2’s DressNPCs core patch to work correctly, but I’m having a bit of trouble with it. I’m following the instructions here.

So-far I’ve cloned the latest TrinityCore, reverted it to this commit, and then attempted to apply the patch.

When I applied the patch using the command git apply DressNPCs.diff I am shown the following errors:

error: patch failed: src/server/game/World/World.cpp:1414
error: src/server/game/World/World.cpp: patch does not apply
error: patch failed: src/server/scripts/Commands/cs_reload.cpp:90
error: src/server/scripts/Commands/cs_reload.cpp: patch does not apply
error: patch failed: src/server/game/Globals/ObjectMgr.cpp:7792
error: src/server/game/Globals/ObjectMgr.cpp: patch does not apply
error: patch failed: src/server/game/Globals/ObjectMgr.h:144
error: src/server/game/Globals/ObjectMgr.h: patch does not apply
error: patch failed: src/server/game/Handlers/SpellHandler.cpp:568
error: src/server/game/Handlers/SpellHandler.cpp: patch does not apply

I then tried the command git apply -v DressNPCs.diff which, I believe, showed me where the errors are when applying the patch. At this point I’m not sure what I could be doing wrong.

Checking patch src/server/game/Globals/ObjectMgr.cpp…
Hunk #1 succeeded at 7792 (offset 83 lines).
Checking patch src/server/game/Globals/ObjectMgr.h…
Hunk #3 succeeded at 1182 (offset 6 lines).
Hunk #4 succeeded at 1328 (offset 6 lines).
Checking patch src/server/game/Handlers/SpellHandler.cpp…
Hunk #1 succeeded at 568 (offset -1 lines).
Checking patch src/server/game/World/World.cpp…
error: while searching for:
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Creature templates…”);
sObjectMgr->LoadCreatureTemplates();

TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates...");           // must be after LoadCreatureTemplates
sObjectMgr->LoadEquipmentTemplates();

error: patch failed: src/server/game/World/World.cpp:1414
error: src/server/game/World/World.cpp: patch does not apply
Checking patch src/server/scripts/Commands/cs_reload.cpp…
error: while searching for:
{ “creature_queststarter”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, “”, NULL },
{ “creature_summon_groups”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureSummonGroupsCommand, “”, NULL },
{ “creature_template”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureTemplateCommand, “”, NULL },
//{ “db_script_string”, SEC_ADMINISTRATOR, true, &HandleReloadDbScriptStringCommand, “”, NULL },
{ “disables”, SEC_ADMINISTRATOR, true, &HandleReloadDisablesCommand, “”, NULL },
{ “disenchant_loot_template”, SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesDisenchantCommand, “”, NULL },

error: patch failed: src/server/scripts/Commands/cs_reload.cpp:90
error: src/server/scripts/Commands/cs_reload.cpp: patch does not apply
Checking patch src/server/game/Globals/ObjectMgr.cpp…
error: while searching for:
}
}

void ObjectMgr::LoadGameTele()
{
uint32 oldMSTime = getMSTime();

error: patch failed: src/server/game/Globals/ObjectMgr.cpp:7792
error: src/server/game/Globals/ObjectMgr.cpp: patch does not apply
Checking patch src/server/game/Globals/ObjectMgr.h…
error: while searching for:

typedef UNORDERED_MAP<uint32, GameTele > GameTeleContainer;

enum ScriptsType
{
SCRIPTS_FIRST = 1,

error: patch failed: src/server/game/Globals/ObjectMgr.h:144
error: src/server/game/Globals/ObjectMgr.h: patch does not apply
Checking patch src/server/game/Handlers/SpellHandler.cpp…
error: while searching for:
if (!unit)
return;

if (!unit->HasAuraType(SPELL_AURA_CLONE_CASTER))
    return;

error: patch failed: src/server/game/Handlers/SpellHandler.cpp:568
error: src/server/game/Handlers/SpellHandler.cpp: patch does not apply
Checking patch src/server/game/World/World.cpp…
Checking patch src/server/scripts/Commands/cs_reload.cpp…
root@Valkryst:/home/trinitycore/TrinityCore# git apply --index DressNPCs.diff
error: patch failed: src/server/game/World/World.cpp:1414
error: src/server/game/World/World.cpp: patch does not apply
error: patch failed: src/server/scripts/Commands/cs_reload.cpp:90
error: src/server/scripts/Commands/cs_reload.cpp: patch does not apply
error: patch failed: src/server/game/Globals/ObjectMgr.cpp:7792
error: src/server/game/Globals/ObjectMgr.cpp: patch does not apply
error: patch failed: src/server/game/Globals/ObjectMgr.h:144
error: src/server/game/Globals/ObjectMgr.h: patch does not apply
error: patch failed: src/server/game/Handlers/SpellHandler.cpp:568
error: src/server/game/Handlers/SpellHandler.cpp: patch does not apply
root@Valkryst:/home/trinitycore/TrinityCore# git apply --reject DressNPCs.diff
Checking patch src/server/game/Globals/ObjectMgr.cpp…
Hunk #1 succeeded at 7792 (offset 83 lines).
Checking patch src/server/game/Globals/ObjectMgr.h…
Hunk #3 succeeded at 1182 (offset 6 lines).
Hunk #4 succeeded at 1328 (offset 6 lines).
Checking patch src/server/game/Handlers/SpellHandler.cpp…
Hunk #1 succeeded at 568 (offset -1 lines).
Checking patch src/server/game/World/World.cpp…
error: while searching for:
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Creature templates…”);
sObjectMgr->LoadCreatureTemplates();

TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates...");           // must be after LoadCreatureTemplates
sObjectMgr->LoadEquipmentTemplates();

error: patch failed: src/server/game/World/World.cpp:1414
Checking patch src/server/scripts/Commands/cs_reload.cpp…
error: while searching for:
{ “creature_queststarter”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, “”, NULL },
{ “creature_summon_groups”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureSummonGroupsCommand, “”, NULL },
{ “creature_template”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureTemplateCommand, “”, NULL },
//{ “db_script_string”, SEC_ADMINISTRATOR, true, &HandleReloadDbScriptStringCommand, “”, NULL },
{ “disables”, SEC_ADMINISTRATOR, true, &HandleReloadDisablesCommand, “”, NULL },
{ “disenchant_loot_template”, SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesDisenchantCommand, “”, NULL },

error: patch failed: src/server/scripts/Commands/cs_reload.cpp:90
Hunk #2 succeeded at 194 (offset -8 lines).
error: while searching for:
return true;
}

static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, const char* /*args*/)
{
    TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_queststarter`)");

error: patch failed: src/server/scripts/Commands/cs_reload.cpp:534
Checking patch src/server/game/Globals/ObjectMgr.cpp…
error: while searching for:
}
}

void ObjectMgr::LoadGameTele()
{
uint32 oldMSTime = getMSTime();

error: patch failed: src/server/game/Globals/ObjectMgr.cpp:7792
Checking patch src/server/game/Globals/ObjectMgr.h…
error: while searching for:

typedef UNORDERED_MAP<uint32, GameTele > GameTeleContainer;

enum ScriptsType
{
SCRIPTS_FIRST = 1,

error: patch failed: src/server/game/Globals/ObjectMgr.h:144
error: while searching for:

    void LoadNPCSpellClickSpells();

    void LoadGameTele();

    void LoadGossipMenu();

error: patch failed: src/server/game/Globals/ObjectMgr.h:966
error: while searching for:
bool AddGameTele(GameTele& data);
bool DeleteGameTele(std::string const& name);

    TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
    {
        CacheTrainerSpellContainer::const_iterator  iter = _cacheTrainerSpellStore.find(entry);

error: patch failed: src/server/game/Globals/ObjectMgr.h:1166
error: while searching for:
PageTextContainer _pageTextStore;
InstanceTemplateContainer _instanceTemplateStore;

private:
    void LoadScripts(ScriptsType type);
    void CheckScripts(ScriptsType type, std::set<int32>& ids);

error: patch failed: src/server/game/Globals/ObjectMgr.h:1310
Checking patch src/server/game/Handlers/SpellHandler.cpp…
error: while searching for:
if (!unit)
return;

if (!unit->HasAuraType(SPELL_AURA_CLONE_CASTER))
    return;

error: patch failed: src/server/game/Handlers/SpellHandler.cpp:568
Checking patch src/server/game/World/World.cpp…
Checking patch src/server/scripts/Commands/cs_reload.cpp…
error: while searching for:
HandleReloadGameTeleCommand(handler, “”);

    HandleReloadCreatureSummonGroupsCommand(handler, "");

    HandleReloadVehicleAccessoryCommand(handler, "");
    HandleReloadVehicleTemplateAccessoryCommand(handler, "");

error: patch failed: src/server/scripts/Commands/cs_reload.cpp:194
Applied patch src/server/game/Globals/ObjectMgr.cpp cleanly.
Applied patch src/server/game/Globals/ObjectMgr.h cleanly.
Applied patch src/server/game/Handlers/SpellHandler.cpp cleanly.
Applying patch src/server/game/World/World.cpp with 1 rejects…
Rejected hunk #1.
Applying patch src/server/scripts/Commands/cs_reload.cpp with 2 rejects…
Rejected hunk #1.
Hunk #2 applied cleanly.
Rejected hunk #3.
Applying patch src/server/game/Globals/ObjectMgr.cpp with 1 rejects…
Rejected hunk #1.
Applying patch src/server/game/Globals/ObjectMgr.h with 4 rejects…
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.
Rejected hunk #4.
Applying patch src/server/game/Handlers/SpellHandler.cpp with 1 rejects…
Rejected hunk #1.
Applied patch src/server/game/World/World.cpp cleanly.
Applying patch src/server/scripts/Commands/cs_reload.cpp with 1 rejects…
Hunk #1 applied cleanly.
Rejected hunk #2.
Hunk #3 applied cleanly.

Oh, just in case I made an error in cloning or reverting, here are the commands I used to clone TrinityCore and revert it:

git clone https://github.com/TrinityCore/TrinityCore
git checkout e4c57d839d83a7e735d4b651827e2dca1ddc68cd

Thanks for any help.

Retry /emoticons/default_smile.png

Hope it works now for you.

Thank you very much Rotchet! It worked flawlessly, and that test NPC looks pretty cool. ^.^

There is already a topic for this, it would have been better to keep this there.

Hi,

I’ve tried to install your patch to my 4.3.4 core but I have a problem. When I want test it with your PNJ exemple, the items skin doesn’t work for me. I’ve just apply your patch and apply the SQL patch to my DB.

You can see in this picture my bad results if you want /emoticons/default_sad.png

http://img4.hostingpics.net/pics/191902Capturedu20140319170340.png

Can you help me please ?

PS : Sorry for my English, I am French.

The patch AND the example are for 3.3.5a.

It is possible that the mirror image packet structure and/or display IDs have changed, messing it up.

See the normal mirror image packet and fix the custom one for it., or use cata displays.

Check the diff. WorldSession::HandleMirrorImageDataRequest

Thank you for your answer, your work is just awesome

This code fix me for my problem. Paste it in file SpellHandler.cpp

http://hastebin.com/ojojacoqij.hs

Sorry for the question, really the mod is good but i dont khow what folder the file DressNPCs.diff needs to put in?

For example: TrinitySourcesqlDressNPCs???

I have a idea to how to use it but not the file DressNPCs.diff localization in the trinitysource folder, grettins!

You can put it in for example the source folder root Source/Then you need to use git to apply it to the source. Read the readme:

https://gist.github.com/Rochet2/2c7683c95d6f9c876980#file-dressnpcs-md

If you get errors due to other custom scripts, try git apply --reject

Then you need to manually add the failed parts, which are in files that end with .rej extension in the source folders.

Do note that this patch possibly does not work on the latest TC without a few changes since some things were removed like UNORDERED_MAP

Thank a lot for your answer, i will try to make it work, thanks!

I could not run the application, gave the git error “DressNPCs.diff” it will be a newer version of trinity core but truth i seen the entire video but this mod only replaced npcs by custom characters.

I expect a more updated and better explained version, it’s just a suggestion, greetings.

Thanks for your help, Greetings!.

Updated to newer TC.

Thanks to Valkryst a bug causing invalid models was fixed.

This occurred when you created an NPC, spawned it, created an outfit for the creature, reloaded outfits and then saved the creature.

Possibly in other situations as well. To fix model bugs, see the modelid field in creature and set it to 0 for DressNPC’s NPCs.

What would be required to add an ‘id’ column and load a random entry if a certain creature entry has more than one outfit assigned to it, such as with creature equip templates?

You would need to add the extra logic to the DB loading as well as to the way the data is stored to allow more than one for an entry.

You would need some kind of indicator, possibly just use the modelid slot as a simple hack, to indicate what outifit is currently in use by the creature.

You would need to recode the extra logic to the packet handler where the outfit is sent to the player. In there additionally if you change races for example, you would need to add in a command for morphing the creature to the right displayID. Atm that is hard set on the creature template on load (hack)

I was fiddling around with the code and I see what you mean regarding changing races or genders. As a test I tried adding an ID column and then changed GetCreatureOutfitMap to load a random ID row from the appropriate creature entry. I noticed that the appearance changed with each load (like relogging or zoning) and changing the race or gender really made the creature look… interesting. /emoticons/default_wink.png Considering my lack of knowledge I probably won’t be able to go beyond that so will likely just create multiple versions of the same NPC. At least that way the appearance won’t be out of sync for different clients.

Thank you for the guidance!

Might implement this. Sounds interesting /emoticons/default_tongue.png

Could actually bind this to the creature model field.

Hows that /emoticons/default_biggrin.png?

Then you could use negative values to set a dress NPC model and the system would use the normal way to pick a random model from them