Code:
///////////////////////////////////////////////////////////////////////////////////////////
// htttp://CodeCraft.Emusoft.Info //
// //
// Portable Morpher //
// Author: Aldaus //
// Description: A ingame item that can morph you into different creatures //
// Credits: Daikenkaiking - For giving me the idea =] //
// //
// //
///////////////////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
//Start of Script
class SCRIPT_DECL Morpher : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy()
{
delete this;
}
};
void Morpher::GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(0, "Goblin", 0);
Menu->AddItem(0, "Felguard", 2);
Menu->AddItem(0, "Broken", 3);
Menu->AddItem(0, "Ogre", 4);
Menu->AddItem(0, "Pirate", 5);
Menu->AddItem(0, "Skeleton", 6);
Menu->AddItem(2, "Demorph", 7);
if(AutoSend)
Menu->SendTo(Plr);
}
//Defining Cases
void Morpher::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
switch(IntId)
{
//Goblin
case 0:
{
Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, 7109);
Plr->Emote(EMOTE_ONESHOT_CHEER);
Plr->Gossip_Complete();
}break;
//FelGuard
case 2:
{
Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, 18287);
Plr->Emote(EMOTE_ONESHOT_CHEER);
Plr->Gossip_Complete();
}break;
//Broken
case 3:
{
Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, 17833);
Plr->Emote(EMOTE_ONESHOT_CHEER);
Plr->Gossip_Complete();
}break;
//Ogre
case 4:
{
Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, 1122);
Plr->Emote(EMOTE_ONESHOT_CHEER);
Plr->Gossip_Complete();
}break;
//Pirate
case 5:
{
Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, 2347);
Plr->Emote(EMOTE_ONESHOT_CHEER);
Plr->Gossip_Complete();
}break;
//Skeleton
case 6:
{
Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, 17970);
Plr->Emote(EMOTE_ONESHOT_CHEER);
Plr->Gossip_Complete();
}break;
//Demorphing :p
case 7:
{
Plr->Emote(EMOTE_ONESHOT_CHEER);
Plr->DeMorph();
Plr->Gossip_Complete();
}break;
}
};
void Morpher::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupMorpher(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new Morpher();
mgr->register_item_gossip_script(60002,gs);
}
Concluding Information: The ID for this item is 60002 from the script, you can change it if necessary.
Code:
INSERT INTO `items` (`class`, `subclass`, `name1`, `name2`, `name3`, `name4`, `displayid`, `quality`, `buyprice`, `sellprice`, `itemlevel`, `ContainerSlots`, `unique`, `maxcount`, `bonding`, `stat_type1`, `stat_value1`, `stat_type2`, `stat_value2`, `stat_type3`, `stat_value3`, `stat_type4`, `stat_value4`, `stat_type5`, `stat_value5`, `stat_type6`, `stat_value6`, `stat_type7`, `stat_value7`, `stat_type8`, `stat_value8`, `dmg_min1`, `dmg_max1`, `dmg_type1`, `dmg_min2`, `dmg_max2`, `dmg_type2`, `dmg_min3`, `dmg_max3`, `dmg_type3`, `dmg_min4`, `dmg_max4`, `dmg_type4`, `dmg_min5`, `dmg_max5`, `dmg_type5`, `delay`, `range`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `armor`, `block`, `spellid_1`, `spelltrigger_1`, `spellcharges_1`, `spellcooldown_1`, `spellcategory_1`, `spellcategorycooldown_1`, `spellid_2`, `spelltrigger_2`, `spellcharges_2`, `spellcooldown_2`, `spellcategory_2`, `spellcategorycooldown_2`, `spellid_3`, `spelltrigger_3`, `spellcharges_3`, `spellcooldown_3`, `spellcategory_3`, `spellcategorycooldown_3`, `spellid_4`, `spelltrigger_4`, `spellcharges_4`, `spellcooldown_4`, `spellcategory_4`, `spellcategorycooldown_4`, `spellid_5`, `spelltrigger_5`, `spellcharges_5`, `spellcooldown_5`, `spellcategory_5`, `spellcategorycooldown_5`, `allowableclass`, `allowablerace`, `RequiredSkill`, `RequiredSkillRank`, `RequiredSkillSubRank`, `RequiredFaction`, `RequiredFactionStanding`, `requiredlevel`, `inventorytype`, `quest_id`, `sheathID`, `itemset`, `MaxDurability`, `Description`, `socket_color_1`, `socket_color_2`, `socket_color_3`, `socket_bonus`, `entry`) VALUES ('8', '-1', 'Portable Morpher', 'Portable Morpher', 'Portable Morpher', 'Portable Morpher', '42629', '1', '0', '0', '0', '0', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '33208', '0', '579', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1503', '1791', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'All hail to the almighty morpher!', '0', '0', '0', '0', '60002');
Original Post: