rendered paste body/*-----------------------------------------------------------------*/
// Script: DotA-ItemFusionOrc.cpp
// © 2006-2007 DotA-WoW Team with assistance of Ascent developers
/*-----------------------------------------------------------------*/
#include "StdAfx.h"
#include "Setup.h"
class SCRIPT_DECL ItemFusionOrcGossip : public GossipScript
{
public:
ADD_GOSSIP_FACTORY_FUNCTION(ItemFusionOrcGossip);
void GossipHello(Creature* pCreature, Player* Plr, bool AutoSend);
void GossipSelectOption(Creature* pCreature, Player* Plr, uint32 Id, uint32 IntId);
void GossipEnd(Creature* pCreature, Player* Plr);
};
void ItemFusionOrcGossip::GossipHello(Creature* pCreature, Player* Plr, bool AutoSend)
{
sLog.outDetail("DotA-ItemFusionOrc.cpp : Hello by %s", Plr->GetName());
GossipMenu *Menu;
uint32 TextID = 820;
// Hello (First) Menu.
objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), TextID, Plr);
Menu->AddItem( 1, "Yasha", 1 );
if(AutoSend)
Menu->SendTo(Plr);
}
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), textid, Plr); \
Menu->SendTo(Plr);
void ItemFusionOrcGossip::GossipSelectOption(Creature* pCreature, Player* Plr, uint32 Id, uint32 IntId)
{
sLog.outDebug("DotA-ItemFusionOrc.cpp : Select option %u by %s", IntId, Plr->GetName());
switch(IntId)
{
case 1: /* Fuse Yasha */
/* (27) Blade of Alacrity + (28) Boots of Elvenskin */
/* (29) Yasha */
if(!Plr->GetItemInterface()->GetItemCount(27, 1) && !Plr->GetItemInterface()->GetItemCount(28, 1)) // Got no items.
{
Plr->BroadcastMessage("You dont have either item!"); // Send the player a notification
return;
}
else if(!Plr->GetItemInterface()->GetItemCount(27, 1) && Plr->GetItemInterface()->GetItemCount(28, 1)) // Got Boots of Elvenskin.
{
Plr->BroadcastMessage("You need the Blade of Alacrity!"); // Send the player a notification
return;
}
else if(Plr->GetItemInterface()->GetItemCount(27, 1) && !Plr->GetItemInterface()->GetItemCount(28, 1)) // Got Blade of Alacrity.
{
Plr->BroadcastMessage("You need the Boots of Elvenskin!"); // Send the player a notification
return;
}
else if(Plr->GetItemInterface()->GetItemCount(27, 1) && Plr->GetItemInterface()->GetItemCount(28, 1)) // Got both Boots of Elvenskin + Blade of Alacrity.
{
Plr->GetItemInterface()->RemoveItemAmt(27, 1); // Remove Ring of Health
Plr->GetItemInterface()->RemoveItemAmt(28, 1); // Remove Void Stone
Item *item = objmgr.CreateItem( 29, Plr); // Create Yasha
Plr->GetItemInterface()->AddItemToFreeSlot(item); // Add the item to a free slot (Checking for a free slot doesn't matter - it will automatically replace)
Plr->BroadcastMessage("You have forged Yasha!"); // Send the player a notification
break;
}
}
}
void ItemFusionOrcGossip::GossipEnd(Creature* pCreature, Player* Plr)
{
GossipScript::GossipEnd(pCreature, Plr);
}
void SetupItemFusionOrcGossip(ScriptMgr * mgr)
{
/* DeleteSkills List */
mgr->register_gossip_script(100003, &ItemFusionOrcGossip::Create); // Orc Recipe Vendor
}