The following warnings occurred:
Warning [2] Undefined variable $search_thread - Line: 60 - File: showthread.php(1617) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1617) : eval()'d code 60 errorHandler->error_callback
/showthread.php 1617 eval
Warning [2] Undefined variable $forumjump - Line: 89 - File: showthread.php(1617) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1617) : eval()'d code 89 errorHandler->error_callback
/showthread.php 1617 eval




Morph Items
#1
Hey guys!

Just wanted to briefly mention this what with the whole durgen focus going on and with new special profiles but in case @Kretol maybe hasn't investigated it yet you can tie commands to items with a touch of C++ coding which would allow you to make items that toggle a morph on and off without GM powarz.

I haven't done it in a while but if I recall correctly it was super easy, anyway just thought I'd throw it out there.
[Image: Signature.png]
Reply
#2
Useful for Druids of the Flame.
"Every gun..."

[Image: Jonah-Hex-Counting-Corpses-Flaming-Leap.jpg]

"...Makes its own tune."


~ The Good, the Bad, and the Ugly ~
Reply
#3
I remember talking with him a bit ago (actually about Druids of the Antler, not Flame) and he said that he didn't know if such a thing was capable, and, if so, didn't know how to do it. Perhaps if you could give a small example or tutorial, Vrahn, it might be good?
Reply
#4
Would be nice to have that on my succubus as well, so I won't have to roll other characters for disguises.
[Image: pj3isZU.gif]

[Image: 43883.png]
Reply
#5
(09-18-2014, 08:36 AM)Beltharean Wrote: Useful for Druids of the Flame.

For a temporary measure, try looking in the Firelands raiding zone for those burning seedpods. They have a drop that will let you turn into a firecat until you leave the form.
Reply
#6
I've got my birthday this weekend so I'm pretty busy, I'll try and dig up a sample to post.
[Image: Signature.png]
Reply
#7
@"Kretol"

Okay!

So, after preforming the fun task that is tracking down all the dependencies to compile TrinityCore I took a quick look into the source code. It's been a looong time but basically this would be the deal, you need to register a new item script class for morph items, this class inherits ItemScript and has a function OnUse which handles code when the item is activated, so the dirt simplest way of doing this would be to make a script for each morph ID you wanted to create and compile it each time for separate items. A fancier way of doing it would be to make a generic handler script that pulled the associated display ID match from a database table that links item GUIDs to display IDs or something similar.

Below I'm pasting an excerpt from cs_modify.cpp which contains the handler for the GM Morph command:
Code:
static bool HandleModifyMorphCommand(ChatHandler* handler, const char* args)
    {
        if (!*args)
            return false;

        uint16 display_id = (uint16)atoi((char*)args);

        Unit* target = handler->getSelectedUnit();
        if (!target)
            target = handler->GetSession()->GetPlayer();

        // check online security
        else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
            return false;

        target->SetDisplayId(display_id);

        return true;
    }

As we can see the obvious part here is assign the target based on the user's target OR just target themselves, then use the SetDisplayId function in the Unit class. (Plus some security / sanity checks, etc.)

So like.... super roughly in untested code, you're looking at adding something like the following in the item_scripts.cpp file:

Code:
class item_morph_player : public ItemScript
{
public:
    item_morph_player() : ItemScript("item_morph_player") { }

    bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override
    {
        player->SetDisplayId(XXXXXXX);
        return true;
    }
};

Again, untested but that should really be it for the simple version. Don't forget you need to register the new class and then associate it to an item which I think is just a database field in the items table. If the above doesn't work you may have to cast Player to Unit, but if memory serves it shouldn't be necessary.

Note that the above is only morphing the user, to do a toggle you'd need to do a check on the player's display ID and if it is different set it to that, otherwise demorph them back to the default display ID, relevant code should be easily located in the Handle Demorph block in cs_modify.cpp.

Let me know if you want any further info.

Cheers.
[Image: Signature.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Forum gold/Purchasable Items Harmonic 18 4,699 01-28-2014, 08:07 AM
Last Post: ProjectRandom
  Adding custom items to vendors? FlyingSquirrel 9 2,476 01-03-2014, 11:45 AM
Last Post: FlyingSquirrel
  Tanuka NPC items? Dae 1 872 11-03-2013, 12:35 PM
Last Post: Maarten
  List of Spawnable Items c0rzilla 10 2,025 09-21-2013, 10:01 PM
Last Post: Reigen
  Druid of the Flame Items [Cosmetic] c0rzilla 11 1,935 08-16-2013, 10:51 PM
Last Post: Harmonic



Users browsing this thread: 1 Guest(s)