Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@ -4783,11 +4783,12 @@ class npc_class_reminder : public CreatureScript
- enum GossipMenuOptions
- {
- GOSSIP_REWARD_ACHIEVEMENT = GOSSIP_ACTION_INFO_DEF + 1,
- GOSSIP_FIX_FACTIONCHANGE_QUESTS = GOSSIP_ACTION_INFO_DEF + 2,
- - GOSSIP_FIX_FACTIONCHANGE_ITEMS = GOSSIP_ACTION_INFO_DEF + 3
- + GOSSIP_FIX_FACTIONCHANGE_ITEMS = GOSSIP_ACTION_INFO_DEF + 3,
- + GOSSIP_FIX_ART_ITEMS = GOSSIP_ACTION_INFO_DEF + 4
- };
- enum eAchievements
- {
- ImprovingOnHistory = 10459
- @@ -4818,15 +4819,95 @@ class npc_class_reminder : public CreatureScript
- p_Player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- + bool OnGossipSelect(Player* p_Player, Creature* p_Creature, uint32 p_Sender, uint32 p_Action) override
- + {
- + p_Player->PlayerTalkClass->ClearMenus();
- + if (p_Sender == eTradeskill::GOSSIP_SENDER_MAIN)
- + {
- + switch (p_Action)
- + {
- + case GossipMenuOptions::GOSSIP_FIX_ART_ITEMS:
- + {
- + std::map<uint32 /* player spec*/, std::pair<uint32 /*child*/, uint32 /*main*/> > data;
- +
- + data[SpecIndex::SPEC_DEMON_HUNTER_VENGEANCE] = std::make_pair(127830, 127829);
- + data[SpecIndex::SPEC_WARRIOR_PROTECTION] = std::make_pair(128288, 128289);
- + data[SpecIndex::SPEC_DK_FROST] = std::make_pair(128293, 128292);
- + data[SpecIndex::SPEC_ROGUE_SUBTLETY] = std::make_pair(128479, 128476);
- + data[SpecIndex::SPEC_DRUID_GUARDIAN] = std::make_pair(128822, 128821);
- + data[SpecIndex::SPEC_DEMON_HUNTER_HAVOC] = std::make_pair(128831, 128832);
- + data[SpecIndex::SPEC_DRUID_FERAL] = std::make_pair(128859, 128860);
- + data[SpecIndex::SPEC_PALADIN_PROTECTION] = std::make_pair(128867, 128866);
- + data[SpecIndex::SPEC_ROGUE_ASSASSINATION] = std::make_pair(128869, 128870);
- + data[SpecIndex::SPEC_SHAMAN_ENHANCEMENT] = std::make_pair(128873, 128819);
- + data[SpecIndex::SPEC_SHAMAN_RESTORATION] = std::make_pair(128934, 128911);
- + data[SpecIndex::SPEC_SHAMAN_ELEMENTAL] = std::make_pair(128936, 128935);
- + data[SpecIndex::SPEC_MONK_WINDWALKER] = std::make_pair(133948, 128940);
- + data[SpecIndex::SPEC_PRIEST_SHADOW] = std::make_pair(128827, 133958);
- + data[SpecIndex::SPEC_ROGUE_OUTLAW] = std::make_pair(134552, 128872);
- + data[SpecIndex::SPEC_WARRIOR_FURY] = std::make_pair(128908, 134553);
- + data[SpecIndex::SPEC_WARLOCK_DEMONOLOGY] = std::make_pair(137246, 128943);
- +
- +
- + auto itr = data.find(p_Player->GetActiveSpecializationID());
- + if (itr == data.end())
- + {
- + ChatHandler(p_Player).PSendSysMessage("Cannot find your spec");
- + break;
- + }
- +
- + if (p_Player->GetItemCount(itr->second.second) != 1)
- + {
- + ChatHandler(p_Player).PSendSysMessage("You have no or more than one main items");
- + break;
- + }
- +
- + std::list<Item*> items;
- + GetAllItems(p_Player, itr->second.first, items);
- + if (items.empty())
- + {
- + ChatHandler(p_Player).PSendSysMessage("You have no child items");
- + break;
- + }
- +
- + Item* l_MainItem = p_Player->GetItemByEntry(itr->second.second);
- + if (l_MainItem == nullptr)
- + {
- + ChatHandler(p_Player).PSendSysMessage("Cannot find main item");
- + break;
- + }
- +
- + std::ostringstream ss;
- + for (Item* p_ChildItem : items)
- + {
- + if (p_ChildItem->HasFlag(ITEM_FIELD_DYNAMIC_FLAGS, ITEM_FIELD_FLAG_CHILD)
- + && p_ChildItem->GetGuidValue(ITEM_FIELD_CREATOR) != 0
- + && p_ChildItem->GetGuidValue(ITEM_FIELD_CREATOR) != l_MainItem->GetGUID())
- + {
- + ss << "Update " << p_ChildItem->GetGUID() << " creator " << l_MainItem->GetGUID();
- + p_ChildItem->SetGuidValue(ITEM_FIELD_CREATOR,
- + l_MainItem->GetGUID());
- + p_ChildItem->SetState(ITEM_CHANGED, p_Player);
- + }
- + }
- +
- + p_Player->SaveToDB();
- + sLog->outError(LOG_FILTER_GENERAL, ss.str().c_str());
- + p_Player->AddDelayedEvent([p_Player]() -> void
- + {
- + p_Player->GetSession()->KickPlayer();
- + }, 1000);
- +
- + break;
- + }
- + default:
- + break;
- + }
- + }
- +
- + p_Player->PlayerTalkClass->SendCloseGossip();
- + return true;
- + }
- +
- + void GetAllItems(Player* p_Player, uint32 p_Entry, std::list<Item*>& p_Items) const
- + {
- + // in inventory
- + for (int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i)
- + if (Item* pItem = p_Player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- + if (pItem->GetEntry() == p_Entry)
- + p_Items.push_back(pItem);
- +
- + for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
- + if (Bag* pBag = p_Player->GetBagByPos(i))
- + for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
- + if (Item* pItem = pBag->GetItemByPos(j))
- + if (pItem->GetEntry() == p_Entry)
- + p_Items.push_back(pItem);
- +
- + for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i)
- + if (Item* pItem = p_Player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- + if (pItem->GetEntry() == p_Entry)
- + p_Items.push_back(pItem);
- +
- + for (uint8 i = CHILD_EQUIPMENT_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
- + if (Item* pItem = p_Player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- + if (pItem->GetEntry() == p_Entry)
- + p_Items.push_back(pItem);
- + }
- +
- bool OnGossipHello(Player* p_Player, Creature* p_Creature) override
- {
- if (p_Player->getLevel() > 10)
- {
- p_Player->ADD_GOSSIP_ITEM_EXTENDED(GossipOptionIcon::GOSSIP_ICON_CHAT, "Try to complete broken achievement.", eTradeskill::GOSSIP_SENDER_MAIN, GossipMenuOptions::GOSSIP_REWARD_ACHIEVEMENT, "Please, input a number of an achievement. ", 0, true);
- + p_Player->ADD_GOSSIP_ITEM_EXTENDED(GossipOptionIcon::GOSSIP_ICON_CHAT, "Try to fix items after merging.", eTradeskill::GOSSIP_SENDER_MAIN, GossipMenuOptions::GOSSIP_FIX_ART_ITEMS, "You should have an active spec for the artifact weapon. You will be disconnected after the fix. Continue?", 1, false);
- }
- p_Player->SEND_GOSSIP_MENU(p_Player->GetGossipTextId(p_Creature), p_Creature->GetGUID());
- return true;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement