[-]
Main Menu
Portal
Forums
Wiki
Rules
FAQs
Events Calendar
Downloads

[-]
Latest Threads
Where Are You Now?
Last Post: Aphetoros
09-06-2019 11:24 AM
» Replies: 7
» Views: 208
What is glistening
Last Post: TwilightDisciple
06-18-2019 06:41 PM
» Replies: 2
» Views: 1339
You Can't Go Home Again
Last Post: Scout
03-15-2019 09:24 PM
» Replies: 0
» Views: 698
You are a fond memory. Good night, CoTH...
Last Post: Stealthscout
09-05-2018 03:04 PM
» Replies: 25
» Views: 83269
"Years of Service" Awards
Last Post: Maulbane
05-26-2018 09:58 PM
» Replies: 100
» Views: 3238

[-]
Who's Online
There are currently no members online.

[-]
Google AdStuff

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]
[-] The following 6 users Like Vrahn's post:
  • flammos200, Beltharean, Scout, SachikoMaeda, Kira13, ThePharaoh
PM
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 ~
[-] The following 1 user Likes Beltharean's post:
  • Scout
PM
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?
PM
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]
PM
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.
PM
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]
[-] The following 1 user Likes Vrahn's post:
  • FlyingSquirrel
PM
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]
[-] The following 5 users Like Vrahn's post:
  • FlyingSquirrel, SachikoMaeda, Sorum, Beltharean, ThePharaoh
PM
Reply


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



Users browsing this thread: 1 Guest(s)

youth-backhand
This forum uses Lukasz Tkacz MyBB addons.