Advertisement
Rochet2

Transmogrification.cpp -- Unfinished localization

Jul 6th, 2012
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 16.76 KB | None | 0 0
  1. /*
  2. 3.3
  3. Transmogrification 3.3.5a - Gossip Menu
  4. By Rochet2
  5. Now with DB implemented
  6.  
  7. ScriptName for NPC:
  8. NPC_Transmogrify
  9.  
  10. TODO:
  11. Make DB saving even better (Deleting)? What about coding?
  12.  
  13. Fix the cost formula
  14.  
  15. TODO in the distant future:
  16.  
  17. Are the qualities right? Blizzard might have changed the quality requirements.
  18. What can and cant be used as source or target..?
  19.  
  20. Cant transmogrify:
  21. rediculus items // Foereaper: would be fun to stab people with a fish
  22. -- Cant think of any good way to handle this easily
  23.  
  24. Cataclysm:
  25. Test on cata -> implement UI xD?
  26. Item link icon to Are You sure text
  27. */
  28. #define CHECK_QUALITY       0 // 0 for no quality checking, 1 for normal quality checks.
  29. #define GOLD_COST           0 // 0 for no gold cost, otherwise used as a multiplier. 1 means normal cost. (float values: 0.5f)
  30.  
  31.  
  32. #include "ScriptPCH.h"
  33. #if(GOLD_COST)
  34. #define GOLDFUNCTION GetSellPrice(OLD)
  35. #else
  36. #define GOLDFUNCTION 0
  37. #endif
  38.  
  39. struct Localization_data
  40. {
  41.     StringVector Text;
  42. };
  43. typedef UNORDERED_MAP<uint32, Localization_data> CustomTextLocale;
  44. CustomTextLocale _CustomTextLocaleStore;
  45.  
  46. #define POPUPs  "Using this item for transmogrify will bind it to you and make it non-refundable and non-tradeable.\nDo you wish to continue?\n\n"+ pItem->GetTemplate()->Name1
  47. enum TextIDs
  48. {
  49.     POPUP_TRANSMOGRIFY,
  50.     REMOVE_ALL_OPTION,
  51.     REMOVE_ALL_POPUP,
  52.     REMOVE_ONE_OPTION,
  53.     REMOVE_ONE_POPUP,
  54.     REFRESH_OPTION,
  55.     BACK_OPTION,
  56.  
  57.     MSG_REMOVE_ALL,
  58.     ERR_REMOVE_ALL,
  59.     MSG_REMOVE_ONE,
  60.     ERR_REMOVE_ONE,
  61.     MSG_TRANSMOGRIFIED,
  62.     ERR_NOT_SUITABLE,
  63.     ERR_NOT_EXISTS,
  64.     ERR_SLOT_EMPTY,
  65.  
  66.     ID_SLOT_HEAD      ,
  67.     ID_SLOT_SHOULDERS ,
  68.     ID_SLOT_BODY      ,
  69.     ID_SLOT_CHEST     ,
  70.     ID_SLOT_WAIST     ,
  71.     ID_SLOT_LEGS      ,
  72.     ID_SLOT_FEET      ,
  73.     ID_SLOT_WRISTS    ,
  74.     ID_SLOT_HANDS     ,
  75.     ID_SLOT_BACK      ,
  76.     ID_SLOT_MAINHAND  ,
  77.     ID_SLOT_OFFHAND   ,
  78.     ID_SLOT_RANGED    ,
  79.     ID_SLOT_TABARD    ,
  80.  
  81.     TEXTIDS_MAX
  82. };
  83.  
  84. class NPC_Transmogrify : public CreatureScript
  85. {
  86. public:
  87.     NPC_Transmogrify() : CreatureScript("NPC_Transmogrify") { }
  88.  
  89.     bool OnGossipHello(Player* pPlayer, Creature* pUnit)
  90.     {
  91.         printf("%s\n", GetText(1, pPlayer)); // Testline
  92.         for (uint8 Slot = EQUIPMENT_SLOT_START; Slot < EQUIPMENT_SLOT_TABARD; Slot++) // EQUIPMENT_SLOT_END
  93.         {
  94.             if (Item* pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, Slot))
  95. #if(CHECK_QUALITY)
  96.                 if(HasGoodQuality(pItem))
  97. #endif
  98.                     if(const char* SlotName = GetSlotName(Slot, pPlayer))
  99.                         pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, SlotName, EQUIPMENT_SLOT_END, Slot);
  100.         }
  101.         pPlayer->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "Remove all transmogrifications", EQUIPMENT_SLOT_END+2, 0, "Remove transmogrifications from all equipped items?", 0, false);
  102.         pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Update Menu", EQUIPMENT_SLOT_END+1, 0);
  103.         pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pUnit->GetGUID());        
  104.         return true;
  105.     }
  106.  
  107.     bool OnGossipSelect(Player* pPlayer, Creature* pUnit, uint32 sender, uint32 uiAction)
  108.     {
  109.         pPlayer->PlayerTalkClass->ClearMenus();
  110.         switch(sender)
  111.         {
  112.         case EQUIPMENT_SLOT_END: // Show items you can use
  113.             {
  114.                 if (Item* OLD = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
  115.                 {
  116.                     uint32 GUID = pPlayer->GetGUIDLow();
  117.                     Items[GUID].clear();
  118.                     uint32 limit = 0;
  119.                     for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
  120.                     {
  121.                         if(limit > 30)
  122.                             break;
  123.                         if (Item* pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
  124.                         {
  125.                             uint32 Display = pItem->GetTemplate()->DisplayInfoID;
  126.                             if(IsSuitable(pItem, OLD, pPlayer))
  127.                                 if(Items[GUID].find(Display) == Items[GUID].end())
  128.                                 {
  129.                                     limit++;
  130.                                     Items[GUID][Display] = pItem;
  131.                                     pPlayer->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, pItem->GetTemplate()->Name1, uiAction, Display, POPUPs, GOLDFUNCTION, false);
  132.                                 }
  133.                         }
  134.                     }
  135.  
  136.                     for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
  137.                     {
  138.                         if (Bag* pBag = pPlayer->GetBagByPos(i))
  139.                             for (uint32 j = 0; j < pBag->GetBagSize(); j++)
  140.                             {
  141.                                 if(limit > 30)
  142.                                     break;
  143.                                 if (Item* pItem = pPlayer->GetItemByPos(i, j))
  144.                                 {
  145.                                     uint32 Display = pItem->GetTemplate()->DisplayInfoID;
  146.                                     if(IsSuitable(pItem, OLD, pPlayer))
  147.                                         if(Items[GUID].find(Display) == Items[GUID].end())
  148.                                         {
  149.                                             limit++;
  150.                                             Items[GUID][Display] = pItem;
  151.                                             pPlayer->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, pItem->GetTemplate()->Name1, uiAction, Display, POPUPs, GOLDFUNCTION, false);
  152.                                         }
  153.                                 }
  154.                             }
  155.                     }
  156.  
  157.                     pPlayer->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, GetText(REMOVE_ONE_OPTION, pPlayer), EQUIPMENT_SLOT_END+3, uiAction, (std::string)GetText(REMOVE_ONE_POPUP, pPlayer)+" "+(std::string)GetSlotName(uiAction, pPlayer)+"?", 0, false);
  158.                     pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, GetText(BACK_OPTION, pPlayer), EQUIPMENT_SLOT_END+1, 0);
  159.                     pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pUnit->GetGUID());
  160.                 }
  161.                 else
  162.                     OnGossipHello(pPlayer, pUnit);
  163.             } break;
  164.         case EQUIPMENT_SLOT_END+1: // Back
  165.             {
  166.                 OnGossipHello(pPlayer, pUnit);
  167.             } break;
  168.         case EQUIPMENT_SLOT_END+2: // Remove Transmogrifications
  169.             {
  170.                 bool removed = false;
  171.                 for (uint8 Slot = EQUIPMENT_SLOT_START; Slot < EQUIPMENT_SLOT_END; Slot++)
  172.                     if (Item* pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, Slot))
  173.                     {
  174.                         if(RemoveDisplay(pItem) && !removed)
  175.                             removed = true;
  176.                         pPlayer->SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (Slot * 2), pItem->GetEntry());
  177.                     }
  178.                     if(removed)
  179.                     {
  180.                         pPlayer->GetSession()->SendAreaTriggerMessage("Transmogrifications removed from equipped items");
  181.                         pPlayer->PlayDirectSound(3337);
  182.                     }
  183.                     else
  184.                         pPlayer->GetSession()->SendNotification("You have no transmogrified items equipped");
  185.                     OnGossipHello(pPlayer, pUnit);
  186.             } break;
  187.         case EQUIPMENT_SLOT_END+3: // Remove Transmogrification from single item
  188.             {
  189.                 if (Item* pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
  190.                 {
  191.                     if(RemoveDisplay(pItem))
  192.                     {
  193.                         pPlayer->GetSession()->SendAreaTriggerMessage("%s transmogrification removed", GetSlotName(uiAction, pPlayer));
  194.                         pPlayer->PlayDirectSound(3337);
  195.                     }
  196.                     else
  197.                         pPlayer->GetSession()->SendNotification("No transmogrification on %s slot", GetSlotName(uiAction, pPlayer));
  198.                     pPlayer->SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (uiAction * 2), pItem->GetEntry());
  199.                 }
  200.                 OnGossipSelect(pPlayer, pUnit, EQUIPMENT_SLOT_END, uiAction);
  201.             } break;
  202.         default: // Transmogrify
  203.             {
  204.                 uint32 GUID = pPlayer->GetGUIDLow();
  205.                 if(Item* OLD = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, sender))
  206.                 {
  207.                     if(Items[GUID].find(uiAction) != Items[GUID].end() && Items[GUID][uiAction]->IsInWorld())
  208.                     {
  209.                         Item* pItem = Items[GUID][uiAction];
  210.                         if(pItem->GetOwnerGUID() == pPlayer->GetGUID() && (pItem->IsInBag() || pItem->GetBagSlot() == INVENTORY_SLOT_BAG_0) && IsSuitable(pItem, OLD, pPlayer))
  211.                         {
  212. #if(GOLD_COST)
  213.                             pPlayer->ModifyMoney(-1*GetSellPrice(OLD)); // take cost
  214. #endif
  215.                             pItem->SetNotRefundable(pPlayer);
  216.                             pItem->SetBinding(true); // soulbound
  217.                             uint32 FakeEntry = pItem->GetEntry();
  218.                             CharacterDatabase.PExecute("REPLACE INTO custom_transmogrification (GUID, FakeEntry) VALUES (%u, %u)", OLD->GetGUIDLow(), FakeEntry);
  219.                             OLD->FakeEntry = FakeEntry;
  220.                             // pPlayer->SetVisibleItemSlot(sender, OLD); // No need to use this, useless checking
  221.                             pPlayer->UpdateUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (sender * 2), FakeEntry); // use this instead
  222.                             pPlayer->PlayDirectSound(3337);
  223.                             pPlayer->GetSession()->SendAreaTriggerMessage("%s transmogrified", GetSlotName(sender, pPlayer));
  224.                         }
  225.                         else
  226.                             pPlayer->GetSession()->SendNotification("Selected items are not suitable");
  227.                     }
  228.                     else
  229.                         pPlayer->GetSession()->SendNotification("Selected item does not exist");
  230.                 }
  231.                 else
  232.                     pPlayer->GetSession()->SendNotification("Equipment slot is empty");
  233.                 Items[GUID].clear();
  234.                 OnGossipSelect(pPlayer, pUnit, EQUIPMENT_SLOT_END, sender);
  235.             } break;
  236.         }
  237.         return true;
  238.     }
  239.  
  240. private:
  241.     std::map<uint64, std::map<uint32, Item*> > Items; // Items[GUID][DISPLAY] = item
  242.  
  243.     char * GetSlotName(uint8 slot, Player* pPlayer)
  244.     {
  245.         switch(slot)
  246.         {
  247.         case EQUIPMENT_SLOT_HEAD      : return GetText(ID_SLOT_HEAD      , pPlayer);
  248.         case EQUIPMENT_SLOT_SHOULDERS : return GetText(ID_SLOT_SHOULDERS , pPlayer);
  249.         case EQUIPMENT_SLOT_BODY      : return GetText(ID_SLOT_BODY      , pPlayer);
  250.         case EQUIPMENT_SLOT_CHEST     : return GetText(ID_SLOT_CHEST     , pPlayer);
  251.         case EQUIPMENT_SLOT_WAIST     : return GetText(ID_SLOT_WAIST     , pPlayer);
  252.         case EQUIPMENT_SLOT_LEGS      : return GetText(ID_SLOT_LEGS      , pPlayer);
  253.         case EQUIPMENT_SLOT_FEET      : return GetText(ID_SLOT_FEET      , pPlayer);
  254.         case EQUIPMENT_SLOT_WRISTS    : return GetText(ID_SLOT_WRISTS    , pPlayer);
  255.         case EQUIPMENT_SLOT_HANDS     : return GetText(ID_SLOT_HANDS     , pPlayer);
  256.         case EQUIPMENT_SLOT_BACK      : return GetText(ID_SLOT_BACK      , pPlayer);
  257.         case EQUIPMENT_SLOT_MAINHAND  : return GetText(ID_SLOT_MAINHAND  , pPlayer);
  258.         case EQUIPMENT_SLOT_OFFHAND   : return GetText(ID_SLOT_OFFHAND   , pPlayer);
  259.         case EQUIPMENT_SLOT_RANGED    : return GetText(ID_SLOT_RANGED    , pPlayer);
  260.         case EQUIPMENT_SLOT_TABARD    : return GetText(ID_SLOT_TABARD    , pPlayer);
  261.         default: return NULL;
  262.         }
  263.     }
  264.  
  265.     bool IsSuitable(Item* pItem, Item* OLD, Player* pPlayer)
  266.     {
  267.         if(OLD->GetTemplate()->DisplayInfoID != pItem->GetTemplate()->DisplayInfoID)
  268.         {
  269.             if(const ItemTemplate* FakeItemTemplate = sObjectMgr->GetItemTemplate(OLD->FakeEntry))
  270.                 if(FakeItemTemplate->DisplayInfoID == pItem->GetTemplate()->DisplayInfoID)
  271.                     return false;
  272.             if(pPlayer->CanUseItem(pItem, false) == EQUIP_ERR_OK)
  273. #if(CHECK_QUALITY)
  274.                 if(HasGoodQuality(pItem))
  275. #endif
  276.                 {
  277.                     uint32 NClass = pItem->GetTemplate()->Class;
  278.                     uint32 OClass = OLD->GetTemplate()->Class;
  279.                     uint32 NSubClass = pItem->GetTemplate()->SubClass;
  280.                     uint32 OSubClass = OLD->GetTemplate()->SubClass;
  281.                     uint32 NEWinv = pItem->GetTemplate()->InventoryType;
  282.                     uint32 OLDinv = OLD->GetTemplate()->InventoryType;
  283.                     if(NClass == OClass) // not possibly the best structure here, but atleast I got my head around this
  284.                         if(NClass == ITEM_CLASS_WEAPON && NSubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE && OSubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
  285.                         {
  286.                             if(NSubClass == OSubClass || ((NSubClass == ITEM_SUBCLASS_WEAPON_BOW || NSubClass == ITEM_SUBCLASS_WEAPON_GUN || NSubClass == ITEM_SUBCLASS_WEAPON_CROSSBOW) && (OSubClass == ITEM_SUBCLASS_WEAPON_BOW || OSubClass == ITEM_SUBCLASS_WEAPON_GUN || OSubClass == ITEM_SUBCLASS_WEAPON_CROSSBOW)))
  287.                                 if(NEWinv == OLDinv || (NEWinv == INVTYPE_WEAPON && (OLDinv == INVTYPE_WEAPONMAINHAND || OLDinv == INVTYPE_WEAPONOFFHAND)))
  288.                                     return true;
  289.                         }
  290.                         else if(NClass == ITEM_CLASS_ARMOR)
  291.                             if(NSubClass == OSubClass)
  292.                                 if(NEWinv == OLDinv || (NEWinv == INVTYPE_CHEST && OLDinv == INVTYPE_ROBE) || (NEWinv == INVTYPE_ROBE && OLDinv == INVTYPE_CHEST))
  293.                                     return true;
  294.                 }
  295.         }
  296.         return false;
  297.     }
  298.  
  299. #if(CHECK_QUALITY)
  300.     bool HasGoodQuality(Item* pItem)
  301.     {
  302.         uint32 Quality = pItem->GetTemplate()->Quality;
  303.         if(Quality == ITEM_QUALITY_UNCOMMON || Quality == ITEM_QUALITY_RARE || Quality == ITEM_QUALITY_EPIC || Quality == ITEM_QUALITY_HEIRLOOM)
  304.             return true;
  305.         return false;
  306.     }
  307. #endif
  308.  
  309. #if(GOLD_COST)
  310.     uint32 GetSellPrice(Item* pItem) // The formula is not blizzlike
  311.     {
  312.         uint32 Price = pItem->GetTemplate()->SellPrice;
  313.         uint32 MinPrice = pItem->GetTemplate()->RequiredLevel * 1176;
  314.         if(Price < MinPrice)
  315.             Price = MinPrice;
  316.         return Price * GOLD_COST;
  317.     }
  318. #endif
  319.  
  320.     bool RemoveDisplay(Item* pItem)
  321.     {
  322.         if(pItem->FakeEntry)
  323.         {
  324.             pItem->FakeEntry = 0;
  325.             CharacterDatabase.PExecute("DELETE FROM custom_transmogrification WHERE GUID = %u", pItem->GetGUIDLow());
  326.             return true;
  327.         }
  328.         return false;
  329.     }
  330.  
  331.     Localization_data const* GetTextLocales(uint32 entry) const
  332.     {
  333.         printf("Getting the textlocales Entry: %u\n", entry);
  334.         CustomTextLocale::const_iterator itr = _CustomTextLocaleStore.find(entry);
  335.         if (itr == _CustomTextLocaleStore.end()) return NULL;
  336.         printf("ReturningTextLocales, not null\n");
  337.         return &itr->second;
  338.     }
  339.  
  340.     char* GetText(uint32 TextID, Player* pPlayer)
  341.     {
  342.         printf("GotHere\n");
  343.         std::string Text = "ERR NO DEFAULT TEXT FOUND";
  344.  
  345.         if (Localization_data const* il = GetTextLocales(TextID))
  346.         {
  347.             ObjectMgr::GetLocaleString(il->Text, 0, Text);
  348.             int loc_idx = 0; // pPlayer->GetSession()->GetSessionDbLocaleIndex();
  349.             if (loc_idx > 0)
  350.             {
  351.                 printf("loc_idx: %u\n", loc_idx);
  352.                 ObjectMgr::GetLocaleString(il->Text, loc_idx, Text);
  353.             }
  354.         }
  355.         std::vector<char> writable(Text.size() + 1);
  356.         std::copy(Text.begin(), Text.end(), writable.begin());
  357.         printf("Returning\n");
  358.         return &writable[0];
  359.     }
  360. };
  361.  
  362. class WORLD_Transmogrify : public WorldScript
  363. {
  364. public:
  365.     WORLD_Transmogrify() : WorldScript("WORLD_Transmogrify") { }
  366.  
  367.     void OnStartup()
  368.     {
  369.         DeleteUnusedTransmogrifications();
  370.         LoadTransmogrificationTexts();
  371.         LoadTransmogrificationLocales();
  372.     }
  373.  
  374. private:
  375.     void DeleteUnusedTransmogrifications()
  376.     {
  377.         sLog->outString("Deleting non-existing transmogrification entries...");
  378.         CharacterDatabase.Execute("DELETE FROM custom_transmogrification WHERE NOT EXISTS (SELECT 1 FROM item_instance WHERE item_instance.guid = custom_transmogrification.GUID)");
  379.         sLog->outString();
  380.     }
  381.  
  382.     void LoadTransmogrificationTexts()
  383.     {
  384.         uint32 oldMSTime = getMSTime();
  385.         AddOriginalText(POPUP_TRANSMOGRIFY, "");
  386.         AddOriginalText(REMOVE_ALL_OPTION , "Remove all transmogrifications");
  387.         AddOriginalText(REMOVE_ALL_POPUP  , "Remove transmogrifications from all equipped items?");
  388.         AddOriginalText(REMOVE_ONE_OPTION , "");
  389.         AddOriginalText(REMOVE_ONE_POPUP  , "Remove transmogrification from");
  390.         AddOriginalText(REFRESH_OPTION    , "Update menu");
  391.         AddOriginalText(BACK_OPTION       , "Back..");
  392.  
  393.         // These could be in Trinity_string
  394.         AddOriginalText(MSG_REMOVE_ALL    , "");
  395.         AddOriginalText(ERR_REMOVE_ALL    , "");
  396.         AddOriginalText(MSG_REMOVE_ONE    , "");
  397.         AddOriginalText(ERR_REMOVE_ONE    , "");
  398.         AddOriginalText(MSG_TRANSMOGRIFIED, "");
  399.         AddOriginalText(ERR_NOT_SUITABLE  , "");
  400.         AddOriginalText(ERR_NOT_EXISTS    , "");
  401.         AddOriginalText(ERR_SLOT_EMPTY    , "");
  402.  
  403.         AddOriginalText(ID_SLOT_HEAD      , "Head");
  404.         AddOriginalText(ID_SLOT_SHOULDERS , "Shoulders");
  405.         AddOriginalText(ID_SLOT_BODY      , "Shirt");
  406.         AddOriginalText(ID_SLOT_CHEST     , "Chest");
  407.         AddOriginalText(ID_SLOT_WAIST     , "Belt");
  408.         AddOriginalText(ID_SLOT_LEGS      , "Legs");
  409.         AddOriginalText(ID_SLOT_FEET      , "Feet");
  410.         AddOriginalText(ID_SLOT_WRISTS    , "Wrists");
  411.         AddOriginalText(ID_SLOT_HANDS     , "Hands");
  412.         AddOriginalText(ID_SLOT_BACK      , "Back");
  413.         AddOriginalText(ID_SLOT_MAINHAND  , "Main hand");
  414.         AddOriginalText(ID_SLOT_OFFHAND   , "Off hand");
  415.         AddOriginalText(ID_SLOT_RANGED    , "Ranged");
  416.         sLog->outString(">> Loaded %u Transmogrification strings in %u ms", TEXTIDS_MAX, GetMSTimeDiffToNow(oldMSTime));
  417.     }
  418.  
  419.     void LoadTransmogrificationLocales()
  420.     {
  421.         uint32 oldMSTime = getMSTime();
  422.         _CustomTextLocaleStore.clear(); // need for reload case
  423.         QueryResult result = WorldDatabase.Query("SELECT entry, text_loc1, text_loc2, text_loc3, text_loc4, text_loc5, text_loc6, text_loc7, text_loc8 FROM custom_locales_transmogrification");
  424.         if (!result)
  425.             return;
  426.         do
  427.         {
  428.             Field* fields = result->Fetch();
  429.             uint32 entry = fields[0].GetUInt32();
  430.             Localization_data& data = _CustomTextLocaleStore[entry];
  431.  
  432.             for (int i = 1; i < TOTAL_LOCALES; ++i)
  433.                 ObjectMgr::AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text);
  434.         } while (result->NextRow());
  435.  
  436.         sLog->outString(">> Loaded %lu Transmogrification locale strings in %u ms", (unsigned long)_CustomTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
  437.         sLog->outString();
  438.     }
  439.  
  440.     void AddOriginalText(uint32 entry, std::string string)
  441.     {
  442.         Localization_data& data = _CustomTextLocaleStore[entry];
  443.         ObjectMgr::AddLocaleString(string, LocaleConstant(0), data.Text);
  444.     }
  445. };
  446.  
  447. void AddSC_NPC_Transmogrify()
  448. {
  449.     new WORLD_Transmogrify();
  450.     new NPC_Transmogrify();
  451. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement