-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathtransmog_scripts.cpp
More file actions
1330 lines (1213 loc) · 60.2 KB
/
transmog_scripts.cpp
File metadata and controls
1330 lines (1213 loc) · 60.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
5.0
Transmogrification 3.3.5a - Gossip menu
By Rochet2
ScriptName for NPC:
Creature_Transmogrify
TODO:
Make DB saving even better (Deleting)? What about coding?
Fix the cost formula
-- Too much data handling, use default costs
Are the qualities right?
Blizzard might have changed the quality requirements.
(TC handles it with stat checks)
Cant transmogrify rediculus items // Foereaper: would be fun to stab people with a fish
-- Cant think of any good way to handle this easily, could rip flagged items from cata DB
*/
#include <unordered_map>
#include "Transmogrification.h"
#include "Chat.h"
#include "ScriptedCreature.h"
#include "ItemTemplate.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "Opcodes.h"
#define sT sTransmogrification
#define GTS session->GetAcoreString // dropped translation support, no one using?
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_HOWWORKS = {
{LOCALE_enUS, "How does transmogrification work?"},
{LOCALE_koKR, "형상변환은 어떻게 작동합니까?"},
{LOCALE_frFR, "Comment fonctionne la transmogrification ?"},
{LOCALE_deDE, "Wie funktioniert Transmogrifizierung?"},
{LOCALE_zhCN, "变形术是如何运作的?"},
{LOCALE_zhTW, "幻化是如何運作的?"},
{LOCALE_esES, "¿Cómo funciona la transfiguración?"},
{LOCALE_esMX, "¿Cómo funciona la transfiguración?"},
{LOCALE_ruRU, "Как работает трансмогрификация?"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_MANAGESETS = {
{LOCALE_enUS, "Manage sets"},
{LOCALE_koKR, "세트 관리"},
{LOCALE_frFR, "Gérer les ensembles"},
{LOCALE_deDE, "Sets verwalten"},
{LOCALE_zhCN, "管理套装"},
{LOCALE_zhTW, "管理套裝"},
{LOCALE_esES, "Administrar conjuntos"},
{LOCALE_esMX, "Administrar conjuntos"},
{LOCALE_ruRU, "Управление комплектами"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_REMOVETRANSMOG = {
{LOCALE_enUS, "Remove all transmogrifications"},
{LOCALE_koKR, "모든 변형 제거"},
{LOCALE_frFR, "Supprimer toutes les transmogrifications"},
{LOCALE_deDE, "Alle Transmogrifikationen entfernen"},
{LOCALE_zhCN, "移除所有幻化"},
{LOCALE_zhTW, "移除所有幻化"},
{LOCALE_esES, "Eliminar todas las transfiguraciones"},
{LOCALE_esMX, "Eliminar todas las transfiguraciones"},
{LOCALE_ruRU, "Удалить все трансмогрификации"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_REMOVETRANSMOG_ASK = {
{LOCALE_enUS, "Remove transmogrifications from all equipped items?"},
{LOCALE_koKR, "장착한 모든 아이템의 변형을 제거합니까?"},
{LOCALE_frFR, "Supprimer les transmogrifications de tous les objets équipés ?"},
{LOCALE_deDE, "Transmogrifikationen von allen ausgerüsteten Gegenständen entfernen?"},
{LOCALE_zhCN, "是否要从所有已装备的物品中移除幻化?"},
{LOCALE_zhTW, "從所有已裝備物品中移除幻化?"},
{LOCALE_esES, "¿Eliminar las transfiguraciones de todos los objetos equipados?"},
{LOCALE_esMX, "¿Eliminar las transfiguraciones de todos los objetos equipados?"},
{LOCALE_ruRU, "Удалить трансмогрификации со всех экипированных предметов?"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_UPDATEMENU = {
{LOCALE_enUS, "Update menu"},
{LOCALE_koKR, "메뉴 업데이트"},
{LOCALE_frFR, "Mettre à jour le menu"},
{LOCALE_deDE, "Menü aktualisieren"},
{LOCALE_zhCN, "更新菜单"},
{LOCALE_zhTW, "更新選單"},
{LOCALE_esES, "Actualizar menú"},
{LOCALE_esMX, "Actualizar menú"},
{LOCALE_ruRU, "Обновить меню"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_HOWSETSWORK = {
{LOCALE_enUS, "How do sets work?"},
{LOCALE_koKR, "세트는 어떻게 작동합니까?"},
{LOCALE_frFR, "Comment fonctionnent les ensembles ?"},
{LOCALE_deDE, "Wie funktionieren Sets?"},
{LOCALE_zhCN, "套装是如何运作的?"},
{LOCALE_zhTW, "套裝如何運作?"},
{LOCALE_esES, "¿Cómo funcionan los conjuntos?"},
{LOCALE_esMX, "¿Cómo funcionan los conjuntos?"},
{LOCALE_ruRU, "Как работают комплекты?"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_SAVESET = {
{LOCALE_enUS, "Save set"},
{LOCALE_koKR, "세트 저장"},
{LOCALE_frFR, "Sauvegarder l'ensemble"},
{LOCALE_deDE, "Set speichern"},
{LOCALE_zhCN, "保存套装"},
{LOCALE_zhTW, "儲存套裝"},
{LOCALE_esES, "Guardar conjunto"},
{LOCALE_esMX, "Guardar conjunto"},
{LOCALE_ruRU, "Сохранить комплект"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_BACK = {
{LOCALE_enUS, "Back..."},
{LOCALE_koKR, "뒤로..."},
{LOCALE_frFR, "Retour..."},
{LOCALE_deDE, "Zurück..."},
{LOCALE_zhCN, "返回..."},
{LOCALE_zhTW, "返回..."},
{LOCALE_esES, "Atrás..."},
{LOCALE_esMX, "Atrás..."},
{LOCALE_ruRU, "Назад..."}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_USESET = {
{LOCALE_enUS, "Use this set"},
{LOCALE_koKR, "이 세트를 사용"},
{LOCALE_frFR, "Utiliser cet ensemble"},
{LOCALE_deDE, "Dieses Set verwenden"},
{LOCALE_zhCN, "使用此套装"},
{LOCALE_zhTW, "使用此套裝"},
{LOCALE_esES, "Usar este conjunto"},
{LOCALE_esMX, "Usar este conjunto"},
{LOCALE_ruRU, "Использовать этот комплект"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_CONFIRM_USESET = {
{LOCALE_enUS, "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"},
{LOCALE_koKR, "이 세트를 변형에 사용하면 변형된 아이템이 계정에 제한되어 환불 및 거래가 불가능합니다.\n계속하시겠습니까?\n\n"},
{LOCALE_frFR, "En utilisant cet ensemble pour la transmogrification, les objets transmogrifiés seront liés à votre personnage et deviendront non remboursables et non échangeables.\nVoulez-vous continuer ?\n\n"},
{LOCALE_deDE, "Wenn du dieses Set für die Transmogrifikation verwendest, werden die transmogrifizierten Gegenstände an dich gebunden und können nicht erstattet oder gehandelt werden.\nMöchtest du fortfahren?\n\n"},
{LOCALE_zhCN, "将此套装用于幻化将使幻化后的物品与您绑定,并使其不可退还和不可交易。\n您是否要继续?\n\n"},
{LOCALE_zhTW, "使用此套裝進行幻化將使幻化後的物品與您綁定,並使其無法退款和無法交易。\n您是否希望繼續?\n\n"},
{LOCALE_esES, "Usar este conjunto para transfigurar vinculará los objetos transfigurados a ti y los volverá no reembolsables y no intercambiables.\n¿Deseas continuar?\n\n"},
{LOCALE_esMX, "Usar este conjunto para transfigurar vinculará los objetos transfigurados a ti y los volverá no reembolsables y no intercambiables.\n¿Deseas continuar?\n\n"},
{LOCALE_ruRU, "Использование этого комплекта для трансмогрификации привяжет трансмогрифицированные предметы к вам и сделает их неподлежащими возврату и обмену.\nЖелаете продолжить?\n\n"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_DELETESET = {
{LOCALE_enUS, "Delete set"},
{LOCALE_koKR, "세트 삭제"},
{LOCALE_frFR, "Supprimer l'ensemble"},
{LOCALE_deDE, "Set löschen"},
{LOCALE_zhCN, "删除套装"},
{LOCALE_zhTW, "刪除套裝"},
{LOCALE_esES, "Eliminar conjunto"},
{LOCALE_esMX, "Eliminar conjunto"},
{LOCALE_ruRU, "Удалить комплект"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_CONFIRM_DELETESET = {
{LOCALE_enUS, "Are you sure you want to delete "},
{LOCALE_koKR, "을(를) 삭제하시겠습니까 "},
{LOCALE_frFR, "Êtes-vous sûr de vouloir supprimer "},
{LOCALE_deDE, "Möchten Sie wirklich löschen "},
{LOCALE_zhCN, "您确定要删除吗 "},
{LOCALE_zhTW, "您確定要刪除 "},
{LOCALE_esES, "¿Estás seguro de que quieres eliminar "},
{LOCALE_esMX, "¿Estás seguro de que quieres eliminar "},
{LOCALE_ruRU, "Вы уверены, что хотите удалить "}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_INSERTSETNAME = {
{LOCALE_enUS, "Insert set name"},
{LOCALE_koKR, "세트 이름 입력"},
{LOCALE_frFR, "Insérer le nom de l'ensemble"},
{LOCALE_deDE, "Set-Namen einfügen"},
{LOCALE_zhCN, "插入套装名称"},
{LOCALE_zhTW, "輸入套裝名稱"},
{LOCALE_esES, "Insertar nombre del conjunto"},
{LOCALE_esMX, "Insertar nombre del conjunto"},
{LOCALE_ruRU, "Введите имя комплекта"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_SEARCH = {
{LOCALE_enUS, "Search..."},
{LOCALE_koKR, "검색..."},
{LOCALE_frFR, "Rechercher..."},
{LOCALE_deDE, "Suche..."},
{LOCALE_zhCN, "搜索..."},
{LOCALE_zhTW, "搜索..."},
{LOCALE_esES, "Buscar..."},
{LOCALE_esMX, "Buscar..."},
{LOCALE_ruRU, "Поиск..."}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_SEARCHING_FOR = {
{LOCALE_enUS, "Searching for: "},
{LOCALE_koKR, "검색 중: "},
{LOCALE_frFR, "Recherche en cours: "},
{LOCALE_deDE, "Suche nach: "},
{LOCALE_zhCN, "正在搜索: "},
{LOCALE_zhTW, "正在搜尋:"},
{LOCALE_esES, "Buscando:" },
{LOCALE_esMX, "Buscando: "},
{LOCALE_ruRU, "Поиск: "}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_SEARCH_FOR_ITEM = {
{LOCALE_enUS, "Search for what item?"},
{LOCALE_koKR, "어떤 아이템을 찾으시겠습니까?"},
{LOCALE_frFR, "Rechercher quel objet ?"},
{LOCALE_deDE, "Nach welchem Gegenstand suchen?"},
{LOCALE_zhCN, "搜索哪个物品?"},
{LOCALE_zhTW, "搜索哪個物品?"},
{LOCALE_esES, "¿Buscar un objeto?"},
{LOCALE_esMX, "¿Buscar un objeto?"},
{LOCALE_ruRU, "Поиск предмета:"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_CONFIRM_HIDE_ITEM = {
{LOCALE_enUS, "You are hiding the item in this slot.\nDo you wish to continue?\n\n"},
{LOCALE_koKR, "이 슬롯에 아이템을 감추고 있습니다.\n계속하시겠습니까?\n\n"},
{LOCALE_frFR, "Vous masquez l'objet dans cet emplacement.\nVoulez-vous continuer ?\n\n"},
{LOCALE_deDE, "Du versteckst das Item in diesem Slot.\nMöchtest du fortfahren?\n\n"},
{LOCALE_zhCN, "您正在隐藏此槽中的物品。\n您是否要继续?\n\n"},
{LOCALE_zhTW, "您正在隱藏此槽中的物品。\n您是否希望繼續?\n\n"},
{LOCALE_esES, "Estás ocultando el objeto en esta ranura.\n¿Deseas continuar?\n\n"},
{LOCALE_esMX, "Estás ocultando el objeto en esta ranura.\n¿Deseas continuar?\n\n"},
{LOCALE_ruRU, "Вы скрываете предмет в этом слоте.\nЖелаете продолжить?\n\n"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_HIDESLOT = {
{LOCALE_enUS, "Hide Slot"},
{LOCALE_koKR, "슬롯 숨기기"},
{LOCALE_frFR, "Cacher l'emplacement"},
{LOCALE_deDE, "Slot verbergen"},
{LOCALE_zhCN, "隐藏槽位"},
{LOCALE_zhTW, "隱藏槽位"},
{LOCALE_esES, "Ocultar ranura"},
{LOCALE_esMX, "Ocultar ranura"},
{LOCALE_ruRU, "Скрыть слот"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_REMOVETRANSMOG_SLOT = {
{LOCALE_enUS, "Remove transmogrification from the slot?"},
{LOCALE_koKR, "해당 슬롯의 형상변환을 제거합니까?"},
{LOCALE_frFR, "Supprimer la transmogrification de l'emplacement ?"},
{LOCALE_deDE, "Transmogrifikation aus dem Slot entfernen?"},
{LOCALE_zhCN, "是否要从该槽位中移除幻化?"},
{LOCALE_zhTW, "從該槽位移除幻化?"},
{LOCALE_esES, "¿Eliminar la transfiguración del espacio?"},
{LOCALE_esMX, "¿Eliminar la transfiguración del espacio?"},
{LOCALE_ruRU, "Удалить трансмогрификацию из ячейки?"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_CONFIRM_USEITEM = {
{LOCALE_enUS, "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"},
{LOCALE_koKR, "이 아이템을 변형에 사용하면 계정에 제한되어 환불 및 거래가 불가능하게 됩니다.\n계속하시겠습니까?\n\n"},
{LOCALE_frFR, "En utilisant cet objet pour la transmogrification, il sera lié à votre personnage et deviendra non remboursable et non échangeable.\nVoulez-vous continuer ?\n\n"},
{LOCALE_deDE, "Wenn du diesen Gegenstand für die Transmogrifikation verwendest, wird er an dich gebunden und kann nicht erstattet oder gehandelt werden.\nMöchtest du fortfahren?\n\n"},
{LOCALE_zhCN, "将此物品用于幻化将使其与您绑定,并使其不可退还和不可交易。\n您是否要继续?\n\n"},
{LOCALE_zhTW, "使用此物品進行幻化將使其與您綁定,並使其無法退款和無法交易。\n您是否希望繼續?\n\n"},
{LOCALE_esES, "Usar este objeto para transfigurar lo vinculará a ti y lo volverá no reembolsable y no intercambiable.\n¿Deseas continuar?\n\n"},
{LOCALE_esMX, "Usar este objeto para transfigurar lo vinculará a ti y lo volverá no reembolsable y no intercambiable.\n¿Deseas continuar?\n\n"},
{LOCALE_ruRU, "Использование этого предмета для трансмогрификации привяжет его к вам и сделает его неподлежащим возврату и обмену.\nЖелаете продолжить?\n\n"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_PREVIOUS_PAGE = {
{LOCALE_enUS, "Previous Page"},
{LOCALE_koKR, "이전 페이지"},
{LOCALE_frFR, "Page précédente"},
{LOCALE_deDE, "Vorherige Seite"},
{LOCALE_zhCN, "上一页"},
{LOCALE_zhTW, "上一頁"},
{LOCALE_esES, "Página anterior"},
{LOCALE_esMX, "Página anterior"},
{LOCALE_ruRU, "Предыдущая страница"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_NEXT_PAGE = {
{LOCALE_enUS, "Next Page"},
{LOCALE_koKR, "다음 페이지"},
{LOCALE_frFR, "Page suivante"},
{LOCALE_deDE, "Nächste Seite"},
{LOCALE_zhCN, "下一页"},
{LOCALE_zhTW, "下一頁"},
{LOCALE_esES, "Página siguiente"},
{LOCALE_esMX, "Página siguiente"},
{LOCALE_ruRU, "Следующая страница"}
};
const std::unordered_map<LocaleConstant, std::string> TRANSMOG_TEXT_ADDED_APPEARANCE = {
{LOCALE_enUS, "has been added to your appearance collection."},
{LOCALE_koKR, "이(가) 외형 컬렉션에 추가되었습니다."},
{LOCALE_frFR, "a été ajouté(e) à votre collection d'apparences."},
{LOCALE_deDE, "wurde deiner Transmog-Sammlung hinzugefügt."},
{LOCALE_zhCN, "已添加到外观收藏中。"},
{LOCALE_zhTW, "已加入您的外觀收藏。"},
{LOCALE_esES, "se ha añadido a tu colección de apariencias."},
{LOCALE_esMX, "se ha agregado a tu colección de apariencias."},
{LOCALE_ruRU, "был добавлен в вашу коллекцию обликов."}
};
std::unordered_map<std::string, const std::unordered_map<LocaleConstant, std::string>*> textMaps = {
{"how_works", &TRANSMOG_TEXT_HOWWORKS},
{"manage_sets", &TRANSMOG_TEXT_MANAGESETS},
{"remove_transmog", &TRANSMOG_TEXT_REMOVETRANSMOG},
{"remove_transmog_ask", &TRANSMOG_TEXT_REMOVETRANSMOG_ASK},
{"update_menu", &TRANSMOG_TEXT_UPDATEMENU},
{"how_sets_work", &TRANSMOG_TEXT_HOWSETSWORK},
{"save_set", &TRANSMOG_TEXT_SAVESET},
{"back", &TRANSMOG_TEXT_BACK},
{"use_set", &TRANSMOG_TEXT_USESET},
{"confirm_use_set", &TRANSMOG_TEXT_CONFIRM_USESET},
{"delete_set", &TRANSMOG_TEXT_DELETESET},
{"confirm_delete_set", &TRANSMOG_TEXT_CONFIRM_DELETESET},
{"insert_set_name", &TRANSMOG_TEXT_INSERTSETNAME},
{"search", &TRANSMOG_TEXT_SEARCH},
{"searching_for", &TRANSMOG_TEXT_SEARCHING_FOR},
{"search_for_item", &TRANSMOG_TEXT_SEARCH_FOR_ITEM},
{"confirm_hide_item", &TRANSMOG_TEXT_CONFIRM_HIDE_ITEM},
{"hide_slot", &TRANSMOG_TEXT_HIDESLOT},
{"remove_transmog_slot", &TRANSMOG_TEXT_REMOVETRANSMOG_SLOT},
{"confirm_use_item", &TRANSMOG_TEXT_CONFIRM_USEITEM},
{"previous_page", &TRANSMOG_TEXT_PREVIOUS_PAGE},
{"next_page", &TRANSMOG_TEXT_NEXT_PAGE},
{"added_appearance", &TRANSMOG_TEXT_ADDED_APPEARANCE}
};
const uint32 FALLBACK_HIDE_ITEM_VENDOR_ID = 9172; //Invisibility potion
const uint32 FALLBACK_REMOVE_TMOG_VENDOR_ID = 1049; //Tablet of Purge
const uint32 CUSTOM_HIDE_ITEM_VENDOR_ID = 57575;//Custom Hide Item item
const uint32 CUSTOM_REMOVE_TMOG_VENDOR_ID = 57576;//Custom Remove Transmog item
std::string GetLocaleText(LocaleConstant locale, const std::string& titleType) {
auto textMapIt = textMaps.find(titleType);
if (textMapIt != textMaps.end()) {
const std::unordered_map<LocaleConstant, std::string>* textMap = textMapIt->second;
auto it = textMap->find(locale);
if (it != textMap->end()) {
return it->second;
}
}
return "";
}
uint32 GetTransmogPrice (ItemTemplate const* targetItem)
{
uint32 price = sT->GetSpecialPrice(targetItem);
price *= sT->GetScaledCostModifier();
price += sT->GetCopperCost();
return price;
}
bool ValidForTransmog (Player* player, Item* target, Item* source, bool hasSearch, std::string searchTerm)
{
if (!target || !source || !player) return false;
ItemTemplate const* targetTemplate = target->GetTemplate();
ItemTemplate const* sourceTemplate = source->GetTemplate();
if (!sT->CanTransmogrifyItemWithItem(player, targetTemplate, sourceTemplate))
return false;
if (sT->GetFakeEntry(target->GetGUID()) == source->GetEntry())
return false;
if (hasSearch && sourceTemplate->Name1.find(searchTerm) == std::string::npos)
return false;
return true;
}
bool CmpTmog (Item* i1, Item* i2)
{
const ItemTemplate* i1t = i1->GetTemplate();
const ItemTemplate* i2t = i2->GetTemplate();
const int q1 = 7-i1t->Quality;
const int q2 = 7-i2t->Quality;
return std::tie(q1, i1t->Name1) < std::tie(q2, i2t->Name1);
}
std::vector<Item*> GetValidTransmogs (Player* player, Item* target, bool hasSearch, std::string searchTerm)
{
std::vector<Item*> allowedItems;
if (!target) return allowedItems;
if (sT->GetUseCollectionSystem())
{
uint32 accountId = player->GetSession()->GetAccountId();
if (sT->collectionCache.find(accountId) == sT->collectionCache.end())
return allowedItems;
for (uint32 itemId : sT->collectionCache[accountId])
{
if (!sObjectMgr->GetItemTemplate(itemId))
continue;
Item* srcItem = Item::CreateItem(itemId, 1, 0);
if (ValidForTransmog(player, target, srcItem, hasSearch, searchTerm))
allowedItems.push_back(srcItem);
}
}
else
{
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
Item* srcItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (ValidForTransmog(player, target, srcItem, hasSearch, searchTerm))
allowedItems.push_back(srcItem);
}
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{
Bag* bag = player->GetBagByPos(i);
if (!bag)
continue;
for (uint32 j = 0; j < bag->GetBagSize(); ++j)
{
Item* srcItem = player->GetItemByPos(i, j);
if (ValidForTransmog(player, target, srcItem, hasSearch, searchTerm))
allowedItems.push_back(srcItem);
}
}
}
if (sConfigMgr->GetOption<bool>("Transmogrification.EnableSortByQualityAndName", true)) {
sort(allowedItems.begin(), allowedItems.end(), CmpTmog);
}
return allowedItems;
}
void PerformTransmogrification (Player* player, uint32 itemEntry, uint32 cost)
{
uint8 slot = sT->selectionCache[player->GetGUID()];
WorldSession* session = player->GetSession();
if (!player->HasEnoughMoney(cost))
{
ChatHandler(session).SendNotification(LANG_ERR_TRANSMOG_NOT_ENOUGH_MONEY);
return;
}
TransmogAcoreStrings res = sT->Transmogrify(player, itemEntry, slot);
if (res == LANG_ERR_TRANSMOG_OK)
session->SendAreaTriggerMessage("{}",GTS(LANG_ERR_TRANSMOG_OK));
else
ChatHandler(session).SendNotification(res);
}
void RemoveTransmogrification (Player* player)
{
uint8 slot = sT->selectionCache[player->GetGUID()];
WorldSession* session = player->GetSession();
if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
if (sT->GetFakeEntry(newItem->GetGUID()))
{
sT->DeleteFakeEntry(player, slot, newItem);
session->SendAreaTriggerMessage("{}", GTS(LANG_ERR_UNTRANSMOG_OK));
}
else
ChatHandler(session).SendNotification(LANG_ERR_UNTRANSMOG_NO_TRANSMOGS);
}
}
class npc_transmogrifier : public CreatureScript
{
public:
npc_transmogrifier() : CreatureScript("npc_transmogrifier") { }
struct npc_transmogrifierAI : ScriptedAI
{
npc_transmogrifierAI(Creature* creature) : ScriptedAI(creature) { };
bool CanBeSeen(Player const* player) override
{
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
if (sT->IsPortableNPCEnabled)
{
if (TempSummon* summon = me->ToTempSummon())
{
return summon->GetOwner() == player;
}
}
return sTransmogrification->IsEnabled() && (target && !target->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).IsEnabled());
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_transmogrifierAI(creature);
}
bool OnGossipHello(Player* player, Creature* creature) override
{
WorldSession* session = player->GetSession();
LocaleConstant locale = session->GetSessionDbLocaleIndex();
// Clear the search string for the player
sT->searchStringByPlayer.erase(player->GetGUID().GetCounter());
if (sT->GetEnableTransmogInfo())
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Misc_Book_11:30:30:-18:0|t" + GetLocaleText(locale, "how_works"), EQUIPMENT_SLOT_END + 9, 0);
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
if (const char* slotName = sT->GetSlotName(slot, session))
{
Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
uint32 entry = newItem ? sT->GetFakeEntry(newItem->GetGUID()) : 0;
std::string icon = entry ? sT->GetItemIcon(entry, 30, 30, -18, 0) : sT->GetSlotIcon(slot, 30, 30, -18, 0);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, icon + std::string(slotName), EQUIPMENT_SLOT_END, slot);
}
}
#ifdef PRESETS
if (sT->GetEnableSets())
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/RAIDFRAME/UI-RAIDFRAME-MAINASSIST:30:30:-18:0|t" + GetLocaleText(locale, "manage_sets"), EQUIPMENT_SLOT_END + 4, 0);
#endif
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Enchant_Disenchant:30:30:-18:0|t" + GetLocaleText(locale, "remove_transmog"), EQUIPMENT_SLOT_END + 2, 0, GetLocaleText(locale, "remove_transmog_ask"), 0, false);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-Undo:30:30:-18:0|t" + GetLocaleText(locale, "update_menu"), EQUIPMENT_SLOT_END + 1, 0);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
return true;
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
{
player->PlayerTalkClass->ClearMenus();
WorldSession* session = player->GetSession();
LocaleConstant locale = session->GetSessionDbLocaleIndex();
// Next page
if (sender > EQUIPMENT_SLOT_END + 10)
{
ShowTransmogItemsInGossipMenu(player, creature, action, sender);
return true;
}
switch (sender)
{
case EQUIPMENT_SLOT_END: // Show items you can use
{
sT->selectionCache[player->GetGUID()] = action;
bool useVendorInterface = player->GetPlayerSetting("mod-transmog", SETTING_VENDOR_INTERFACE).IsEnabled();
if (sT->GetUseVendorInterface() || useVendorInterface)
ShowTransmogItemsInFakeVendor(player, creature, action);
else
ShowTransmogItemsInGossipMenu(player, creature, action, sender);
break;
}
case EQUIPMENT_SLOT_END + 1: // Main menu
OnGossipHello(player, creature);
break;
case EQUIPMENT_SLOT_END + 2: // Remove Transmogrifications
{
bool removed = false;
auto 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
ChatHandler(session).SendNotification(LANG_ERR_UNTRANSMOG_NO_TRANSMOGS);
OnGossipHello(player, creature);
} break;
case EQUIPMENT_SLOT_END + 3: // Remove Transmogrification from single item
{
RemoveTransmogrification(player);
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())
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Misc_Book_11:30:30:-18:0|t" + GetLocaleText(locale, "how_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)
AddGossipItemFor(player, 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())
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/GuildBankFrame/UI-GuildBankFrame-NewTab:30:30:-18:0|t" + GetLocaleText(locale, "save_set"), EQUIPMENT_SLOT_END + 8, 0);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|t" + GetLocaleText(locale, "back"), EQUIPMENT_SLOT_END + 1, 0);
SendGossipMenuFor(player, 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)
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(it->second, 30, 30, -18, 0) + sT->GetItemLink(it->second, session), sender, action);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Misc_Statue_02:30:30:-18:0|t" + GetLocaleText(locale, "use_set"), EQUIPMENT_SLOT_END + 5, action, GetLocaleText(locale, "confirm_use_set") + sT->presetByName[player->GetGUID()][action], 0, false);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-LeaveItem-Opaque:30:30:-18:0|t" + GetLocaleText(locale, "delete_set"), EQUIPMENT_SLOT_END + 7, action, GetLocaleText(locale, "confirm_delete_set") + sT->presetByName[player->GetGUID()][action] + "?", 0, false);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|t" + GetLocaleText(locale, "back"), EQUIPMENT_SLOT_END + 4, 0);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
} break;
case EQUIPMENT_SLOT_END + 7: // Delete preset
{
if (!sT->GetEnableSets())
{
OnGossipHello(player, creature);
return true;
}
// action = presetID
CharacterDatabase.Execute("DELETE FROM `custom_transmogrification_sets` WHERE Owner = {} AND PresetID = {}", player->GetGUID().GetCounter(), 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;
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(entry, 30, 30, -18, 0) + sT->GetItemLink(entry, session), EQUIPMENT_SLOT_END + 8, 0);
}
}
if (canSave)
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/GuildBankFrame/UI-GuildBankFrame-NewTab:30:30:-18:0|t" + GetLocaleText(locale, "save_set"), 0, 0, GetLocaleText(locale, "insert_set_name"), cost*sT->GetSetCostModifier() + sT->GetSetCopperCost(), true);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-Undo:30:30:-18:0|t" + GetLocaleText(locale, "update_menu"), sender, action);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|t" + GetLocaleText(locale, "back"), EQUIPMENT_SLOT_END + 4, 0);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
} break;
case EQUIPMENT_SLOT_END + 10: // Set info
{
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|t" + GetLocaleText(locale, "back"), EQUIPMENT_SLOT_END + 4, 0);
SendGossipMenuFor(player, sT->GetSetNpcText(), creature->GetGUID());
} break;
#endif
case EQUIPMENT_SLOT_END + 9: // Transmog info
{
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|t" + GetLocaleText(locale, "back"), EQUIPMENT_SLOT_END + 1, 0);
SendGossipMenuFor(player, sT->GetTransmogNpcText(), creature->GetGUID());
} break;
default: // Transmogrify
{
if (!sender && !action)
{
OnGossipHello(player, creature);
return true;
}
PerformTransmogrification(player, action, sender);
CloseGossipMenuFor(player); // Wait for SetMoney to get fixed, issue #10053
} break;
}
return true;
}
#ifdef PRESETS
bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) override
{
player->PlayerTalkClass->ClearMenus();
if (sender)
{
// "sender" is an equipment slot for a search - execute the search
std::string searchString(code);
if (searchString.length() > MAX_SEARCH_STRING_LENGTH)
searchString = searchString.substr(0, MAX_SEARCH_STRING_LENGTH);
sT->searchStringByPlayer.erase(player->GetGUID().GetCounter());
sT->searchStringByPlayer.insert({player->GetGUID().GetCounter(), searchString});
OnGossipSelect(player, creature, EQUIPMENT_SLOT_END, sender - 1);
return true;
}
if (action)
return true; // should never happen
if (!sT->GetEnableSets())
{
OnGossipHello(player, creature);
return true;
}
std::string name(code);
if (name.find('"') != std::string::npos || name.find('\\') != std::string::npos)
ChatHandler(player->GetSession()).SendNotification(LANG_PRESET_ERR_INVALID_NAME);
else
{
for (uint8 presetID = 0; presetID < sT->GetMaxSets(); ++presetID) // should never reach over max
{
if (sT->presetByName[player->GetGUID()].find(presetID) != sT->presetByName[player->GetGUID()].end())
continue; // Just remember never to use presetByName[pGUID][presetID] when finding etc!
int32 cost = 0;
std::map<uint8, uint32> items;
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
if (!sT->GetSlotName(slot, player->GetSession()))
continue;
if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
uint32 entry = sT->GetFakeEntry(newItem->GetGUID());
if (!entry)
continue;
if (entry != HIDDEN_ITEM_ID)
{
const ItemTemplate* temp = sObjectMgr->GetItemTemplate(entry);
if (!temp)
continue;
if (!sT->SuitableForTransmogrification(player, temp))
continue;
cost += sT->GetSpecialPrice(temp);
}
items[slot] = entry;
}
}
if (items.empty())
break; // no transmogrified items were found to be saved
cost *= sT->GetSetCostModifier();
cost += sT->GetSetCopperCost();
if (!player->HasEnoughMoney(cost))
{
ChatHandler(player->GetSession()).SendNotification(LANG_ERR_TRANSMOG_NOT_ENOUGH_MONEY);
break;
}
std::ostringstream ss;
for (std::map<uint8, uint32>::iterator it = items.begin(); it != items.end(); ++it)
{
ss << uint32(it->first) << ' ' << it->second << ' ';
sT->presetById[player->GetGUID()][presetID][it->first] = it->second;
}
sT->presetByName[player->GetGUID()][presetID] = name; // Make sure code doesnt mess up SQL!
CharacterDatabase.Execute("REPLACE INTO `custom_transmogrification_sets` (`Owner`, `PresetID`, `SetName`, `SetData`) VALUES ({}, {}, \"{}\", \"{}\")", player->GetGUID().GetCounter(), uint32(presetID), name, ss.str());
if (cost)
player->ModifyMoney(-cost);
break;
}
}
//OnGossipSelect(player, creature, EQUIPMENT_SLOT_END+4, 0);
CloseGossipMenuFor(player); // Wait for SetMoney to get fixed, issue #10053
return true;
}
#endif
void ShowTransmogItemsInGossipMenu(Player* player, Creature* creature, uint8 slot, uint16 gossipPageNumber) // Only checks bags while can use an item from anywhere in inventory
{
WorldSession* session = player->GetSession();
LocaleConstant locale = session->GetSessionDbLocaleIndex();
Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
bool hasSearchString;
uint16 pageNumber = 0;
uint32 startValue = 0;
uint32 endValue = MAX_OPTIONS - 4;
bool lastPage = true;
if (gossipPageNumber > EQUIPMENT_SLOT_END + 10)
{
pageNumber = gossipPageNumber - EQUIPMENT_SLOT_END - 10;
startValue = (pageNumber * (MAX_OPTIONS - 2));
endValue = (pageNumber + 1) * (MAX_OPTIONS - 2) - 1;
}
if (oldItem)
{
uint32 price = GetTransmogPrice(oldItem->GetTemplate());
std::ostringstream ss;
ss << std::endl;
if (sT->GetRequireToken())
ss << std::endl << std::endl << sT->GetTokenAmount() << " x " << sT->GetItemLink(sT->GetTokenEntry(), session);
std::string lineEnd = ss.str();
std::unordered_map<uint32, std::string>::iterator searchStringIterator = sT->searchStringByPlayer.find(player->GetGUID().GetCounter());
hasSearchString = !(searchStringIterator == sT->searchStringByPlayer.end());
std::string searchDisplayValue(hasSearchString ? searchStringIterator->second : GetLocaleText(locale, "search"));
std::vector<Item*> allowedItems = GetValidTransmogs(player, oldItem, hasSearchString, searchDisplayValue);
if (allowedItems.size() > 0)
{
lastPage = false;
// Offset values to add Search gossip item
if (pageNumber == 0)
{
if (hasSearchString)
{
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(30620, 30, 30, -18, 0) + GetLocaleText(locale, "searching_for") + searchDisplayValue, slot + 1, 0, GetLocaleText(locale, "search_for_item"), 0, true);
}
else
{
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(30620, 30, 30, -18, 0) + GetLocaleText(locale, "search"), slot + 1, 0, GetLocaleText(locale, "search_for_item"), 0, true);
}
}
else
{
startValue--;
}
if (sT->GetAllowHiddenTransmog())
{
// Offset the start and end values to make space for invisible item entry
endValue--;
if (pageNumber != 0)
{
startValue--;
}
else
{
// Add invisible item entry
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/inv_misc_enggizmos_27:30:30:-18:0|t" + GetLocaleText(locale, "hide_slot"), slot, UINT_MAX, GetLocaleText(locale, "confirm_hide_item") + lineEnd, 0, false);
}
}
for (uint32 i = startValue; i <= endValue; i++)
{
if (allowedItems.empty() || i > allowedItems.size() - 1)
{
lastPage = true;
break;
}
Item* newItem = allowedItems.at(i);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(newItem->GetEntry(), 30, 30, -18, 0) + sT->GetItemLink(newItem, session), slot, newItem->GetEntry(), GetLocaleText(locale, "confirm_use_item") + sT->GetItemIcon(newItem->GetEntry(), 40, 40, -15, -10) + sT->GetItemLink(newItem, session) + lineEnd, price, false);
}
}
if (gossipPageNumber == EQUIPMENT_SLOT_END + 11)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GetLocaleText(locale, "previous_page"), EQUIPMENT_SLOT_END, slot);
if (!lastPage)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GetLocaleText(locale, "next_page"), gossipPageNumber + 1, slot);
}
}
else if (gossipPageNumber > EQUIPMENT_SLOT_END + 11)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GetLocaleText(locale, "previous_page"), gossipPageNumber - 1, slot);
if (!lastPage)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GetLocaleText(locale, "next_page"), gossipPageNumber + 1, slot);
}
}
else if (!lastPage)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Next Page", EQUIPMENT_SLOT_END + 11, slot);
}
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/INV_Enchant_Disenchant:30:30:-18:0|t" + GetLocaleText(locale, "remove_transmog"), EQUIPMENT_SLOT_END + 3, slot, GetLocaleText(locale, "remove_transmog_slot"), 0, false);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-Undo:30:30:-18:0|t" + GetLocaleText(locale, "update_menu"), EQUIPMENT_SLOT_END, slot);
}
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|t" + GetLocaleText(locale, "back"), EQUIPMENT_SLOT_END + 1, 0);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
}
static std::vector<ItemTemplate const*> GetSpoofedVendorItems (Item* target)
{
std::vector<ItemTemplate const*> spoofedItems;
uint32 existingTransmog = sT->GetFakeEntry(target->GetGUID());
if (sT->AllowHiddenTransmog && !existingTransmog)
{
ItemTemplate const* _hideSlotButton = sObjectMgr->GetItemTemplate(CUSTOM_HIDE_ITEM_VENDOR_ID);
if (_hideSlotButton)
spoofedItems.push_back(_hideSlotButton);
else
{
_hideSlotButton = sObjectMgr->GetItemTemplate(FALLBACK_HIDE_ITEM_VENDOR_ID);
spoofedItems.push_back(_hideSlotButton);
}
}
if (existingTransmog)
{
ItemTemplate const* _removeTransmogButton = sObjectMgr->GetItemTemplate(CUSTOM_REMOVE_TMOG_VENDOR_ID);
if (_removeTransmogButton)
spoofedItems.push_back(_removeTransmogButton);
else
{
_removeTransmogButton = sObjectMgr->GetItemTemplate(FALLBACK_REMOVE_TMOG_VENDOR_ID);
spoofedItems.push_back(_removeTransmogButton);
}
}
return spoofedItems;
}
static uint32 GetSpoofedItemPrice (uint32 itemId, ItemTemplate const* target)
{
switch (itemId)
{
case CUSTOM_HIDE_ITEM_VENDOR_ID:
case FALLBACK_HIDE_ITEM_VENDOR_ID:
return sT->HiddenTransmogIsFree ? 0 : sT->GetSpecialPrice(target);
default:
return 0;
}
}
static void EncodeItemToPacket (WorldPacket& data, ItemTemplate const* proto, uint8& slot, uint32 price)
{
data << uint32(slot + 1);
data << uint32(proto->ItemId);
data << uint32(proto->DisplayInfoID);
data << int32 (-1); //Infinite Stock
data << uint32(price);
data << uint32(proto->MaxDurability);
data << uint32(1); //Buy Count of 1
data << uint32(0);
slot++;
}
//The actual vendor options are handled in the player script below, OnBeforeBuyItemFromVendor
static void ShowTransmogItemsInFakeVendor (Player* player, Creature* creature, uint8 slot)
{
Item* targetItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (!targetItem)
{
ChatHandler(player->GetSession()).SendNotification(LANG_ERR_TRANSMOG_MISSING_DEST_ITEM);
CloseGossipMenuFor(player);
return;
}
ItemTemplate const* targetTemplate = targetItem->GetTemplate();
std::vector<Item*> itemList = GetValidTransmogs(player, targetItem, false, "");
std::vector<ItemTemplate const*> spoofedItems = GetSpoofedVendorItems(targetItem);
uint32 itemCount = itemList.size();
uint32 spoofCount = spoofedItems.size();
uint32 totalItems = itemCount + spoofCount;
uint32 price = GetTransmogPrice(targetItem->GetTemplate());
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + totalItems * 8 * 4);
data << uint64(creature->GetGUID().GetRawValue());
uint8 count = 0;
size_t count_pos = data.wpos();
data << uint8(count);
for (uint32 i = 0; i < spoofCount && count < MAX_VENDOR_ITEMS; ++i)
{
EncodeItemToPacket (
data, spoofedItems[i], count,
GetSpoofedItemPrice(spoofedItems[i]->ItemId, targetTemplate)
);
}
for (uint32 i = 0; i < itemCount && count < MAX_VENDOR_ITEMS; ++i)
{
ItemTemplate const* _proto = itemList[i]->GetTemplate();
if (_proto) EncodeItemToPacket(data, _proto, count, price);
}
data.put(count_pos, count);
player->GetSession()->SendPacket(&data);
}
};
class PS_Transmogrification : public PlayerScript
{
private:
void AddToDatabase(Player* player, Item* item)
{
if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE) && !sTransmogrification->GetAllowTradeable())
return;