Exemple #1
0
 bool GossipSelect_teleguy(Player *player, Creature *_Creature, uint32 sender, uint32 action )
 {
     // Main menu
     if (sender == GOSSIP_SENDER_MAIN)
         OnGossipSelect(player, _Creature, 0, action);
     return true;
 }
		bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 sender, uint32 uiAction)
		{
			pPlayer->PlayerTalkClass->ClearMenus();
			std::string name;
			switch(uiAction)
			{
				case 0:
					name = pPlayer->GetName();
					pPlayer->ADD_GOSSIP_ITEM(10, "Each Title costs an event token", GOSSIP_SENDER_MAIN, 8888);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " Hand of A'dal", GOSSIP_SENDER_MAIN, 64);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Seeker", GOSSIP_SENDER_MAIN, 81);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " of the Ten Storms", GOSSIP_SENDER_MAIN, 86);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " of the Emerald Dream", GOSSIP_SENDER_MAIN, 87);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " of Khaz Modan", GOSSIP_SENDER_MAIN, 112);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Lion Hearted", GOSSIP_SENDER_MAIN, 114);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Forsaken", GOSSIP_SENDER_MAIN, 119);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Magic Seeker", GOSSIP_SENDER_MAIN, 120);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " of the Nightfall", GOSSIP_SENDER_MAIN, 140);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Immortal", GOSSIP_SENDER_MAIN, 141);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Undying", GOSSIP_SENDER_MAIN, 142);       
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Insane", GOSSIP_SENDER_MAIN, 145);      
					pPlayer->ADD_GOSSIP_ITEM(4, name + " the Astral Walker", GOSSIP_SENDER_MAIN, 165);
					pPlayer->ADD_GOSSIP_ITEM(4, name + " Herald of the Titans", GOSSIP_SENDER_MAIN, 166);       
					pPlayer->ADD_GOSSIP_ITEM(4, "Flame Keeper " + name, GOSSIP_SENDER_MAIN, 76);                          
					pPlayer->ADD_GOSSIP_ITEM(4, "Stalker " + name, GOSSIP_SENDER_MAIN, 91);            
					pPlayer->ADD_GOSSIP_ITEM(4, "Assassin " + name, GOSSIP_SENDER_MAIN, 95);
					pPlayer->ADD_GOSSIP_ITEM(4, "Merrymaker " + name, GOSSIP_SENDER_MAIN, 134);
					pPlayer->ADD_GOSSIP_ITEM(4, "Bloodsail Admiral " + name, GOSSIP_SENDER_MAIN, 144);
					pPlayer->ADD_GOSSIP_ITEM(4, "Starcaller " + name, GOSSIP_SENDER_MAIN, 164);
					pPlayer->PlayerTalkClass->SendGossipMenu(20000, pCreature->GetGUID());
					break;
				case 1:
					pPlayer->GetSession()->SendListInventory(pCreature->GetGUID());
					break;
				case 8888:
					OnGossipSelect(pPlayer, pCreature, GOSSIP_SENDER_MAIN, 0);
					break;
				default:
					if(pPlayer->HasItemCount(EVENT_TOKEN, 1))
					{
						CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(uiAction);
						if(!titleInfo)
							return false;
						pPlayer->SetTitle(titleInfo, false);
						pCreature->MonsterWhisper("Enjoy your new title!", pPlayer->GetGUID());
						pPlayer->DestroyItemCount(EVENT_TOKEN, 1, true);
						pPlayer->PlayerTalkClass->SendCloseGossip();
					}
					break;
			}
			return true;
		}
Exemple #3
0
    bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 uiAction, const char* code) // happens when an extended gossip item is selected and the code is set to true for the gossip item.
    {
        player->PlayerTalkClass->ClearMenus();
 
        uint32 amount = 0;
    uint32 gold = 0;
        amount = uint32(atol(code)); 
		gold = amount * 10000;
 
		std::ostringstream message;
 
        if(amount < 50) 
        {
            player->GetSession()->SendNotification("Usted no tiene suficiente oro!");
        }
        else
        {
			
 
            if(urand(1,2) == 1) 
            {
				player->ModifyMoney(player->GetMoney() + gold);
				player->PlayDirectSound(3337);
                player->CastSpell(player, 47292);
				player->CastSpell(player, 44940);
				message << "¡Felicidades " << player->GetName() << " Has ganado!";
				player->MonsterWhisper(message.str().c_str(), player->GetGUID());
				
            }
            else
            {
				player->ModifyMoney(player->GetMoney() - gold);
				message << "Así que lo siento, " << player->GetName() << " que ha perdido.";
				player->MonsterWhisper(message.str().c_str(), player->GetGUID());
            }
        }
        OnGossipSelect(player, creature, sender, 0);
        return true;
    }
Exemple #4
0
    bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
    {
        player->PlayerTalkClass->ClearMenus();
        WorldSession* session = player->GetSession();
        switch(sender)
        {
        case EQUIPMENT_SLOT_END: // Show items you can use
            ShowTransmogItems(player, creature, action);
            break;
        case EQUIPMENT_SLOT_END+1: // Main menu
            OnGossipHello(player, creature);
            break;
        case EQUIPMENT_SLOT_END+2: // Remove Transmogrifications
            {
                bool removed = false;
                SQLTransaction trans = CharacterDatabase.BeginTransaction();
                for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
                {
                    if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
                    {
                        if (!sT->GetFakeEntry(newItem->GetGUID()))
                            continue;
                        sT->DeleteFakeEntry(player, slot, newItem, &trans);
                        removed = true;
                    }
                }
                if (removed)
                {
                    session->SendAreaTriggerMessage(GTS(LANG_ERR_UNTRANSMOG_OK));
                    CharacterDatabase.CommitTransaction(trans);
                }
                else
                    session->SendNotification(LANG_ERR_UNTRANSMOG_NO_TRANSMOGS);
                OnGossipHello(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+3: // Remove Transmogrification from single item
            {
                if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, action))
                {
                    if (sT->GetFakeEntry(newItem->GetGUID()))
                    {
                        sT->DeleteFakeEntry(player, action, newItem);
                        session->SendAreaTriggerMessage(GTS(LANG_ERR_UNTRANSMOG_OK));
                    }
                    else
                        session->SendNotification(LANG_ERR_UNTRANSMOG_NO_TRANSMOGS);
                }
                OnGossipSelect(player, creature, EQUIPMENT_SLOT_END, action);
            } break;
#ifdef PRESETS
        case EQUIPMENT_SLOT_END+4: // Presets menu
            {
                if (!sT->GetEnableSets())
                {
                    OnGossipHello(player, creature);
                    return true;
                }
                if (sT->GetEnableSetInfo())
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Misc_Book_11:30:30:-18:0|tHow sets work", EQUIPMENT_SLOT_END+10, 0);
                for (Transmogrification::presetIdMap::const_iterator it = sT->presetByName[player->GetGUID()].begin(); it != sT->presetByName[player->GetGUID()].end(); ++it)
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Misc_Statue_02:30:30:-18:0|t"+it->second, EQUIPMENT_SLOT_END+6, it->first);

                if (sT->presetByName[player->GetGUID()].size() < sT->GetMaxSets())
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/GuildBankFrame/UI-GuildBankFrame-NewTab:30:30:-18:0|tSave set", EQUIPMENT_SLOT_END+8, 0);
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|tBack..", EQUIPMENT_SLOT_END+1, 0);
                player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
            } break;
        case EQUIPMENT_SLOT_END+5: // Use preset
            {
                if (!sT->GetEnableSets())
                {
                    OnGossipHello(player, creature);
                    return true;
                }
                // action = presetID
                for (Transmogrification::slotMap::const_iterator it = sT->presetById[player->GetGUID()][action].begin(); it != sT->presetById[player->GetGUID()][action].end(); ++it)
                {
                    if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, it->first))
                        sT->PresetTransmog(player, item, it->second, it->first);
                }
                OnGossipSelect(player, creature, EQUIPMENT_SLOT_END+6, action);
            } break;
        case EQUIPMENT_SLOT_END+6: // view preset
            {
                if (!sT->GetEnableSets())
                {
                    OnGossipHello(player, creature);
                    return true;
                }
                // action = presetID
                for (Transmogrification::slotMap::const_iterator it = sT->presetById[player->GetGUID()][action].begin(); it != sT->presetById[player->GetGUID()][action].end(); ++it)
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(it->second, 30, 30, -18, 0)+sT->GetItemLink(it->second, session), sender, action);

                player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Misc_Statue_02:30:30:-18:0|tUse set", EQUIPMENT_SLOT_END+5, action, "Using this set for transmogrify will bind transmogrified items to you and make them non-refundable and non-tradeable.\nDo you wish to continue?\n\n"+sT->presetByName[player->GetGUID()][action], 0, false);
                player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-LeaveItem-Opaque:30:30:-18:0|tDelete set", EQUIPMENT_SLOT_END+7, action, "Are you sure you want to delete "+sT->presetByName[player->GetGUID()][action]+"?", 0, false);
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|tBack..", EQUIPMENT_SLOT_END+4, 0);
                player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
            } break;
        case EQUIPMENT_SLOT_END+7: // Delete preset
            {
                if (!sT->GetEnableSets())
                {
                    OnGossipHello(player, creature);
                    return true;
                }
                // action = presetID
                CharacterDatabase.PExecute("DELETE FROM `custom_transmogrification_sets` WHERE Owner = %u AND PresetID = %u",  player->GetGUIDLow(), action);
                sT->presetById[player->GetGUID()][action].clear();
                sT->presetById[player->GetGUID()].erase(action);
                sT->presetByName[player->GetGUID()].erase(action);

                OnGossipSelect(player, creature, EQUIPMENT_SLOT_END+4, 0);
            } break;
        case EQUIPMENT_SLOT_END+8: // Save preset
            {
                if (!sT->GetEnableSets() || sT->presetByName[player->GetGUID()].size() >= sT->GetMaxSets())
                {
                    OnGossipHello(player, creature);
                    return true;
                }
                uint32 cost = 0;
                bool canSave = false;
                for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
                {
                    if (!sT->GetSlotName(slot, session))
                        continue;
                    if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
                    {
                        uint32 entry = sT->GetFakeEntry(newItem->GetGUID());
                        if (!entry)
                            continue;
                        const ItemTemplate* temp = sObjectMgr->GetItemTemplate(entry);
                        if (!temp)
                            continue;
                        if (!sT->SuitableForTransmogrification(player, temp)) // no need to check?
                            continue;
                        cost += sT->GetSpecialPrice(temp);
                        canSave = true;
                        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(entry, 30, 30, -18, 0)+sT->GetItemLink(entry, session), EQUIPMENT_SLOT_END+8, 0);
                    }
                }
                if (canSave)
                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "|TInterface/GuildBankFrame/UI-GuildBankFrame-NewTab:30:30:-18:0|tSave set", 0, 0, "Insert set name", cost*sT->GetSetCostModifier()+sT->GetSetCopperCost(), true);
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-Undo:30:30:-18:0|tUpdate menu", sender, action);
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|tBack..", EQUIPMENT_SLOT_END+4, 0);
                player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
            } break;
        case EQUIPMENT_SLOT_END+10: // Set info
            {
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|tBack..", EQUIPMENT_SLOT_END+4, 0);
                player->SEND_GOSSIP_MENU(sT->GetSetNpcText(), creature->GetGUID());
            } break;
#endif
        case EQUIPMENT_SLOT_END+9: // Transmog info
            {
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|tBack..", EQUIPMENT_SLOT_END+1, 0);
                player->SEND_GOSSIP_MENU(sT->GetTransmogNpcText(), creature->GetGUID());
            } break;
        default: // Transmogrify
            {
                if (!sender && !action)
                {
                    OnGossipHello(player, creature);
                    return true;
                }
                // sender = slot, action = display
                TransmogTrinityStrings res = sT->Transmogrify(player, MAKE_NEW_GUID(action, 0, HIGHGUID_ITEM), sender);
                if (res == LANG_ERR_TRANSMOG_OK)
                    session->SendAreaTriggerMessage(GTS(LANG_ERR_TRANSMOG_OK));
                else
                    session->SendNotification(res);
                // OnGossipSelect(player, creature, EQUIPMENT_SLOT_END, sender);
                // ShowTransmogItems(player, creature, sender);
                player->CLOSE_GOSSIP_MENU(); // Wait for SetMoney to get fixed, issue #10053
            } break;
        }
        return true;
    }
    bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code)
    {
        player->PlayerTalkClass->ClearMenus();
 
        std::string targetName(code);
        if (player->GetName() == targetName)
        {
            player->GetSession()->SendNotification("You can not challenge yourself");
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
 
        Player* target = sObjectAccessor->FindPlayerByName(targetName);
        if (!target)
        {
            player->GetSession()->SendNotification("Challenged player not logged in");
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
 
        if (player->GetGUID() == target->GetGUID())
        {
            player->GetSession()->SendNotification("You can not challenge yourself");
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
 
        if (target->GetZoneId() != player->GetZoneId())
        {
            player->GetSession()->SendNotification("%s is not in same zone", target->GetName().c_str());
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
 
#if (USE_TOKEN == 1)
        if (!player->HasItemCount(TOKEN_ID, action))
        {
            player->GetSession()->SendNotification("You do not have enough tokens");
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
 
        if (!target->HasItemCount(TOKEN_ID, action))
        {
            player->GetSession()->SendNotification("%s does not have enough tokens", target->GetName().c_str());
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
#else
        if (target->GetMoney() < action * GOLD)
        {
            player->GetSession()->SendNotification("%s does not have enough money", target->GetName().c_str());
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
 
        if (player->GetMoney() < action * GOLD)
        {
            player->GetSession()->SendNotification("You do not have enough money");
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
#endif
 
        if (!bloodMoney.AddChallenger(target->GetGUIDLow(), player->GetGUIDLow(), action))
        {
            player->GetSession()->SendNotification("One of you already challenged the other");
            OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF);
            return true;
        }
 
        creature->Whisper(player->GetName() + " has requested a Blood Money duel with you!", LANG_UNIVERSAL, target, true);
        player->CLOSE_GOSSIP_MENU();
        return true;
    }
Exemple #6
0
	bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 action )
		{
		  if (!player->getAttackers().empty())
	{
		creature->MonsterWhisper(MSG_ERR_INCOMBAT, player->GetGUID());
		player->CLOSE_GOSSIP_MENU();
        return false;
		  }

		  switch (action)
	{
		 case 2:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(144);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 3:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(62);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 4:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(135);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 5:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(141);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 6:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(138);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 7:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(170);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 8:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(28);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 9:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(48);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 10:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(134);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 11:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(72);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 12:
			   player->PlayerTalkClass->ClearMenus();
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_42, GOSSIP_SENDER_MAIN, 13);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_113, GOSSIP_SENDER_MAIN, 14);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_147, GOSSIP_SENDER_MAIN, 15);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_143, GOSSIP_SENDER_MAIN, 16);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_79, GOSSIP_SENDER_MAIN, 17);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_64, GOSSIP_SENDER_MAIN, 18);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_43, GOSSIP_SENDER_MAIN, 19);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_80, GOSSIP_SENDER_MAIN, 20);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_47, GOSSIP_SENDER_MAIN, 21);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_122, GOSSIP_SENDER_MAIN, 22);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, MSG_GOSSIP_TEXT_BACK_1, GOSSIP_SENDER_MAIN, 56);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, MSG_GOSSIP_TEXT_NEXT_3, GOSSIP_SENDER_MAIN, 23);
			   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,creature->GetGUID());
			   break;
		 case 13:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(42);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
	     case 14:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(113);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
	     case 15:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(147);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 16:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(143);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 17:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(79);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
	     case 18:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(64);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 19:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(43);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
	     case 20:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(80);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 21:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(47);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
	     case 22:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(122);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 23:
			   player->PlayerTalkClass->ClearMenus();
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_81, GOSSIP_SENDER_MAIN, 24);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_78, GOSSIP_SENDER_MAIN, 25);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_156, GOSSIP_SENDER_MAIN, 26);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_83, GOSSIP_SENDER_MAIN, 27);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_71, GOSSIP_SENDER_MAIN, 28);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_142, GOSSIP_SENDER_MAIN, 29);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_146, GOSSIP_SENDER_MAIN, 30);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_150, GOSSIP_SENDER_MAIN, 31);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_46, GOSSIP_SENDER_MAIN, 32);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_278, GOSSIP_SENDER_MAIN, 33);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, MSG_GOSSIP_TEXT_BACK_2, GOSSIP_SENDER_MAIN, 57);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, MSG_GOSSIP_TEXT_NEXT_4, GOSSIP_SENDER_MAIN, 34);
			   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,creature->GetGUID());
			   break;
		 case 24:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(81);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 25:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(78);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 26:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(156);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 27:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(83);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 28:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(71);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 29:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(142);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 30:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(146);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 31:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(150);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 32:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(46);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 33:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(278);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 34:
			   player->PlayerTalkClass->ClearMenus();
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_139, GOSSIP_SENDER_MAIN, 35);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_77, GOSSIP_SENDER_MAIN, 36);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_74, GOSSIP_SENDER_MAIN, 37);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_45, GOSSIP_SENDER_MAIN, 38);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_177, GOSSIP_SENDER_MAIN, 39);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_151, GOSSIP_SENDER_MAIN, 40);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_171, GOSSIP_SENDER_MAIN, 41);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_131, GOSSIP_SENDER_MAIN, 42);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_173, GOSSIP_SENDER_MAIN, 43);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_157, GOSSIP_SENDER_MAIN, 44);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, MSG_GOSSIP_TEXT_BACK_3, GOSSIP_SENDER_MAIN, 58);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, MSG_GOSSIP_TEXT_NEXT_5, GOSSIP_SENDER_MAIN, 45);
			   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,creature->GetGUID());
			   break;
		 case 35:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(139);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 36:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(77);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 37:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(74);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 38:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(45);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 39:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(177);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 40:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(151);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 41:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(171);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 42:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(131);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 43:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(173);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 44:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(157);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 45:
			   player->PlayerTalkClass->ClearMenus();
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_75, GOSSIP_SENDER_MAIN, 46);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_140, GOSSIP_SENDER_MAIN, 47);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_172, GOSSIP_SENDER_MAIN, 48);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_124, GOSSIP_SENDER_MAIN, 49);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_133, GOSSIP_SENDER_MAIN, 50);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_76, GOSSIP_SENDER_MAIN, 51);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_125, GOSSIP_SENDER_MAIN, 52);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_145, GOSSIP_SENDER_MAIN, 53);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_155, GOSSIP_SENDER_MAIN, 54);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, MSG_GOSSIP_TEXT_84, GOSSIP_SENDER_MAIN, 55);
			   player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, MSG_GOSSIP_TEXT_BACK_4, GOSSIP_SENDER_MAIN, 59);
			   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,creature->GetGUID());
			   break;
		 case 46:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(75);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 47:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(140);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		case 48:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(172);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
	     case 49:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(124);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
	     case 50:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(133);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 51:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(125);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 52:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(76);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 53:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(145);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 54:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(155);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 55:
			   {CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(84);
			   AddTitle(player, creature, titleInfo);
			   }
			   break;
		 case 56:
			 OnGossipHello(player, creature);
			   break;
		 case 57:
			 OnGossipSelect(player, creature, sender, 12);
			 break;
		 case 58:
			 OnGossipSelect(player, creature, sender, 23);
			 break;
		 case 59:
			 OnGossipSelect(player, creature, sender, 34);
			 break;
}
	
		  return true;
	}
    bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 uiAction)
    {
        WorldSession* session = player->GetSession();
        player->PlayerTalkClass->ClearMenus();
        switch(sender)
        {
        case EQUIPMENT_SLOT_END: // Show items you can use
            {
                if (Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
                {
                    uint32 lowGUID = player->GetGUIDLow();
                    _items[lowGUID].clear();
                    uint32 limit = 0;
                    uint32 price = 0;
                    switch (sTransmogrification->GetRequireGold())
                    {
                    case 1: { price = (unsigned int)(GetFakePrice(oldItem)*sTransmogrification->GetGoldModifier()); } break;
                    case 2: { price = (unsigned int)sTransmogrification->GetGoldCost(); } break;
                    }
                    char tokenCost[250] = "\n";
                    if(sTransmogrification->GetRequireToken())
                        snprintf(tokenCost, 250, "\n\n%u x %s", sTransmogrification->GetTokenAmount(), GetItemName(sObjectMgr->GetItemTemplate(sTransmogrification->GetTokenEntry()), session).c_str());

                    for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
                    {
                        if (limit > 30)
                            break;
                        if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
                        {
                            uint32 display = newItem->GetTemplate()->DisplayInfoID;
                            if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                            {
                                if (_items[lowGUID].find(display) == _items[lowGUID].end())
                                {
                                    limit++;
                                    _items[lowGUID][display] = newItem;
                                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, GetItemName(newItem->GetTemplate(), session), uiAction, display, session->GetTrinityString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem->GetTemplate(), session)+tokenCost, price, false);
                                }
                            }
                        }
                    }

                    for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
                    {
                        if (Bag* bag = player->GetBagByPos(i))
                        {
                            for (uint32 j = 0; j < bag->GetBagSize(); j++)
                            {
                                if (limit > 30)
                                    break;
                                if (Item* newItem = player->GetItemByPos(i, j))
                                {
                                    uint32 display = newItem->GetTemplate()->DisplayInfoID;
                                    if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                                    {
                                        if (_items[lowGUID].find(display) == _items[lowGUID].end())
                                        {
                                            limit++;
                                            _items[lowGUID][display] = newItem;
                                            player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, GetItemName(newItem->GetTemplate(), session), uiAction, display, session->GetTrinityString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem->GetTemplate(), session)+tokenCost, price, false);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    char removeOnePopup[250];
                    snprintf(removeOnePopup, 250, session->GetTrinityString(LANG_POPUP_REMOVE_ONE), GetSlotName(uiAction, session));
                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, session->GetTrinityString(LANG_OPTION_REMOVE_ONE), EQUIPMENT_SLOT_END+3, uiAction, removeOnePopup, 0, false);
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, session->GetTrinityString(LANG_OPTION_BACK), EQUIPMENT_SLOT_END+1, 0);
                    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
                }
                else
                    OnGossipHello(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+1: // Back
            {
                OnGossipHello(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+2: // Remove Transmogrifications
            {
                bool removed = false;
                for (uint8 Slot = EQUIPMENT_SLOT_START; Slot < EQUIPMENT_SLOT_END; Slot++)
                {
                    if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, Slot))
                    {
                        if (newItem->DeleteFakeEntry() && !removed)
                            removed = true;
                    }
                }
                if (removed)
                {
                    session->SendAreaTriggerMessage(session->GetTrinityString(LANG_REM_TRANSMOGRIFICATIONS_ITEMS));
                    player->PlayDirectSound(3337);
                }
                else
                    session->SendNotification(session->GetTrinityString(LANG_ERR_NO_TRANSMOGRIFICATIONS));
                OnGossipHello(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+3: // Remove Transmogrification from single item
            {
                if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
                {
                    if (newItem->DeleteFakeEntry())
                    {
                        session->SendAreaTriggerMessage(session->GetTrinityString(LANG_REM_TRANSMOGRIFICATION_ITEM), GetSlotName(uiAction, session));
                        player->PlayDirectSound(3337);
                    }
                    else
                        session->SendNotification(session->GetTrinityString(LANG_ERR_NO_TRANSMOGRIFICATION), GetSlotName(uiAction, session));
                }
                OnGossipSelect(player, creature, EQUIPMENT_SLOT_END, uiAction);
            } break;
        default: // Transmogrify
            {
                uint32 lowGUID = player->GetGUIDLow();
                if(!sTransmogrification->GetRequireToken() || player->GetItemCount(sTransmogrification->GetTokenEntry()) >= sTransmogrification->GetTokenAmount())
                {
                    if (Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, sender))
                    {
                        if (_items[lowGUID].find(uiAction) != _items[lowGUID].end() && _items[lowGUID][uiAction]->IsInWorld())
                        {
                            Item* newItem = _items[lowGUID][uiAction];
                            if (newItem->GetOwnerGUID() == player->GetGUIDLow() && (newItem->IsInBag() || newItem->GetBagSlot() == INVENTORY_SLOT_BAG_0) && player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                            {
                                switch(sTransmogrification->GetRequireGold())
                                {
                                case 1: { player->ModifyMoney(-1*(uint32)(GetFakePrice(oldItem)*sTransmogrification->GetGoldModifier())); } break;
                                case 2: { player->ModifyMoney(-1*(unsigned int)sTransmogrification->GetGoldCost()); } break;
                                }
                                if(sTransmogrification->GetRequireToken())
                                    player->DestroyItemCount(sTransmogrification->GetTokenEntry(), sTransmogrification->GetTokenAmount(), true);
                                oldItem->SetFakeEntry(newItem->GetEntry());
                                newItem->SetNotRefundable(player);
                                newItem->SetBinding(true);
                                player->PlayDirectSound(3337);
                                session->SendAreaTriggerMessage(session->GetTrinityString(LANG_ITEM_TRANSMOGRIFIED), GetSlotName(sender, session));
                            }
                            else
                                session->SendNotification(session->GetTrinityString(LANG_ERR_NO_ITEM_SUITABLE));
                        }
                        else
                            session->SendNotification(session->GetTrinityString(LANG_ERR_NO_ITEM_EXISTS));
                    }
                    else
                        session->SendNotification(session->GetTrinityString(LANG_ERR_EQUIP_SLOT_EMPTY));
                }
                else
                    session->SendNotification(session->GetTrinityString(LANG_ERR_NO_TOKEN), GetItemName(sObjectMgr->GetItemTemplate(sTransmogrification->GetTokenEntry()), session).c_str());
                _items[lowGUID].clear();
                OnGossipSelect(player, creature, EQUIPMENT_SLOT_END, sender);
            } break;
        }
        return true;
    }
Exemple #8
0
    bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
    {
        WorldSession* session = player->GetSession();
        player->PlayerTalkClass->ClearMenus();
        switch(sender)
        {
        case SENDER_SELECT_VENDOR: // action = slot
            {
                Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, action);
                if (!item)
                {
                    if (const char* slotname = getSlotName(action))
                        session->SendNotification("No item equipped in %s slot", slotname);
                    OnGossipHello(player, creature);
                    return true;
                }
                const ItemTemplate * itemTemplate = item->GetTemplate();
                optionData* oM = &optionMap[(itemTemplate->Class == ITEM_CLASS_WEAPON ? MAX_ITEM_SUBCLASS_WEAPON : 0)+itemTemplate->SubClass][getCorrectInvType(itemTemplate->InventoryType)];
                if (!oM->size())
                {
                    if (const char* slotname = getSlotName(action))
                        session->SendNotification("No transmogrifications available for %s", slotname);
                    OnGossipHello(player, creature);
                    return true;
                }
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, (std::string)"Update selected; "+getItemName(itemTemplate, session), sender, action);
                for(optionData::iterator it = oM->begin(); it != oM->end(); ++it)
                {
                    if (!TransmogDisplayVendorMgr::AllowedQuality(it->first)) // skip not allowed qualities
                        continue;
                    for(uint32 count = 0; count*MAX_VENDOR_ITEMS < it->second.size(); ++count)
                    {
                        std::ostringstream ss;
                        ss << getQualityName(it->first);
                        if (count)
                            ss << " [" << count << "]";
                        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, ss.str().c_str(), it->first, count*MAX_VENDOR_ITEMS);
                    }
                }
                if (player->PlayerTalkClass->GetGossipMenu().GetMenuItemCount() <= 1)
                {
                    if (const char* slotname = getSlotName(action))
                        session->SendNotification("No transmogrifications available for %s", slotname);
                    player->PlayerTalkClass->ClearMenus();
                    OnGossipHello(player, creature);
                    return true;
                }
                selDataStruct temp = {action, 0, 0}; // slot, offset, quality
                selData[player->GetGUIDLow()] = temp;
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Back..", SENDER_BACK, 0);
                player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
            } break;
        case SENDER_BACK: // Back
            {
                OnGossipHello(player, creature);
            } break;
        case SENDER_REMOVE_ALL: // Remove TransmogDisplayVendorMgrs
            {
                bool removed = false;
                for (uint8 Slot = EQUIPMENT_SLOT_START; Slot < EQUIPMENT_SLOT_END; Slot++)
                {
                    if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, Slot))
                    {
                        if (TransmogDisplayVendorMgr::DeleteFakeEntry(newItem) && !removed)
                            removed = true;
                    }
                }
                if (removed)
                {
                    session->SendAreaTriggerMessage("Transmogrifications removed from equipped items");
                    player->PlayDirectSound(3337);
                }
                else
                    session->SendNotification("You have no transmogrified items equipped");
                OnGossipSelect(player, creature, SENDER_REMOVE_MENU, 0);
            } break;
        case SENDER_REMOVE_ONE: // Remove TransmogDisplayVendorMgr from single item
            {
                const char* slotname = getSlotName(action);
                if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, action))
                {
                    if (TransmogDisplayVendorMgr::DeleteFakeEntry(newItem))
                    {
                        if (slotname)
                            session->SendAreaTriggerMessage("%s transmogrification removed", slotname);
                        player->PlayDirectSound(3337);
                    }
                    else if (slotname)
                        session->SendNotification("No transmogrification on %s slot", slotname);
                }
                else if (slotname)
                    session->SendNotification("No item equipped in %s slot", slotname);
                OnGossipSelect(player, creature, SENDER_REMOVE_MENU, 0);
            } break;
        case SENDER_REMOVE_MENU:
            {
                for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; slot++)
                {
                    const char* slotname = getSlotName(slot);
                    if (!slotname)
                        continue;
                    std::ostringstream ss;
                    ss << "Remove transmogrification from " << slotname << "?";
                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, (std::string)"Remove from "+slotname, SENDER_REMOVE_ONE, slot, ss.str().c_str(), 0, false);
                }
                player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "Remove all transmogrifications", SENDER_REMOVE_ALL, 0, "Are you sure you want to remove all transmogrifications?", 0, false);
                player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Back..", SENDER_BACK, 0);
                player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
            } break;
        default: // Show items you can use
            {
                if (sender >= MAX_ITEM_QUALITY) // sender = quality, action = iterator
                    return false; // cheat
                if (selData.find(player->GetGUIDLow()) == selData.end())
                    return false; // cheat
                if (selData[player->GetGUIDLow()].offset != 0 || selData[player->GetGUIDLow()].quality != 0)
                    return false; // cheat (something is off)
                selData[player->GetGUIDLow()].offset = action;
                selData[player->GetGUIDLow()].quality = sender;
                uint32 slot = selData[player->GetGUIDLow()].slot; // slot
                if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
                {
                    if (!TransmogDisplayVendorMgr::AllowedQuality(item->GetTemplate()->Quality))
                    {
                        session->SendNotification("Equipped item has wrong quality");
                        OnGossipSelect(player, creature, SENDER_SELECT_VENDOR, slot);
                        return true;
                    }
                    optionDataList oM = optionMap[(item->GetTemplate()->Class == ITEM_CLASS_WEAPON ? MAX_ITEM_SUBCLASS_WEAPON : 0)+item->GetTemplate()->SubClass][getCorrectInvType(item->GetTemplate()->InventoryType)][sender];
                    uint32 itemCount = (oM.size()-action);
                    if (itemCount > MAX_VENDOR_ITEMS)
                        itemCount = MAX_VENDOR_ITEMS;
                    if (!itemCount)
                    {
                        session->SendAreaTriggerMessage("No items found");
                        OnGossipSelect(player, creature, SENDER_SELECT_VENDOR, slot);
                        return true;
                    }
                    player->CLOSE_GOSSIP_MENU();

                    TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY");

                    Creature* vendor = player->GetNPCIfCanInteractWith(creature->GetGUID(), UNIT_NPC_FLAG_VENDOR);
                    if (!vendor)
                    {
                        TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", creature->GetGUIDLow());
                        player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
                        return true;
                    }

                    if (player->HasUnitState(UNIT_STATE_DIED))
                        player->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);

                    if (vendor->HasUnitState(UNIT_STATE_MOVING))
                        vendor->StopMoving();
                    uint8 count = 0;

                    WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + itemCount * 8 * 4);
                    data << uint64(creature->GetGUID());

                    size_t countPos = data.wpos();
                    data << uint8(count);

                    bool added = false;
                    optionDataList::iterator it = oM.begin();
                    std::advance(it, action);
                    for (; it != oM.end() && count < itemCount; ++it, ++count)
                    {
                        if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(*it))
                        {
                            data << uint32(count + 1);
                            data << uint32(itemTemplate->ItemId);
                            data << uint32(itemTemplate->DisplayInfoID);
                            data << int32(0xFFFFFFFF);
                            data << uint32(0);
                            data << uint32(itemTemplate->MaxDurability);
                            data << uint32(itemTemplate->BuyCount);
                            data << uint32(0);
                            added = true;
                        }
                    }

                    if (!added)
                    {
                        data << uint8(0);
                        session->SendPacket(&data);
                    }
                    else
                    {
                        data.put<uint8>(countPos, count);
                        session->SendPacket(&data);
                    }
                }
                else
                {
                    session->SendNotification("No item equipped");
                    OnGossipSelect(player, creature, SENDER_SELECT_VENDOR, slot);
                    return true;
                }
            } break;
        }
        return true;
    }