AltAdvancement.cpp 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "AltAdvancement.h"
  17. #include "../../common/ConfigReader.h"
  18. #include "../../common/Log.h"
  19. #include "../Spells.h"
  20. #include "../classes.h"
  21. #include "../Rules/Rules.h"
  22. #include <map>
  23. #include <assert.h>
  24. #include <mysql.h>
  25. #include "../../common/DatabaseNew.h"
  26. #include "../WorldDatabase.h"
  27. extern ConfigReader configReader;
  28. extern MasterSpellList master_spell_list;
  29. extern Classes classes;
  30. extern RuleManager rule_manager;
  31. extern MasterAANodeList master_tree_nodes;
  32. MasterAAList::MasterAAList()
  33. {
  34. MMasterAAList.SetName("MasterAAList::AAList");
  35. }
  36. MasterAAList::~MasterAAList()
  37. {
  38. DestroyAltAdvancements();
  39. }
  40. void MasterAAList::AddAltAdvancement(AltAdvanceData* data) {
  41. MMasterAAList.writelock(__FUNCTION__, __LINE__);
  42. AAList.push_back(data);
  43. MMasterAAList.releasewritelock(__FUNCTION__, __LINE__);
  44. }
  45. int MasterAAList::Size() {
  46. return AAList.size();
  47. }
  48. // Jabantiz: Probably a better way to do this but can't think of it right now
  49. AltAdvanceData* MasterAAList::GetAltAdvancement(int32 spellID) {
  50. vector<AltAdvanceData*>::iterator itr;
  51. AltAdvanceData* data = NULL;
  52. MMasterAAList.readlock(__FUNCTION__, __LINE__);
  53. for (itr = AAList.begin(); itr != AAList.end(); itr++) {
  54. if ((*itr)->spellID == spellID) {
  55. data = (*itr);
  56. break;
  57. }
  58. }
  59. MMasterAAList.releasereadlock(__FUNCTION__, __LINE__);
  60. return data;
  61. }
  62. void MasterAAList::DestroyAltAdvancements() {
  63. MMasterAAList.writelock(__FUNCTION__, __LINE__);
  64. vector<AltAdvanceData*>::iterator itr;
  65. for (itr = AAList.begin(); itr != AAList.end(); itr++)
  66. safe_delete(*itr);
  67. AAList.clear();
  68. MMasterAAList.releasewritelock(__FUNCTION__, __LINE__);
  69. }
  70. MasterAANodeList::MasterAANodeList() {
  71. }
  72. MasterAANodeList::~MasterAANodeList() {
  73. DestroyTreeNodes();
  74. }
  75. void MasterAANodeList::AddTreeNode(TreeNodeData* data) {
  76. TreeNodeList.push_back(data);
  77. }
  78. void MasterAANodeList::DestroyTreeNodes() {
  79. vector<TreeNodeData*>::iterator itr;
  80. for (itr = TreeNodeList.begin(); itr != TreeNodeList.end(); itr++)
  81. safe_delete(*itr);
  82. TreeNodeList.clear();
  83. }
  84. int MasterAANodeList::Size() {
  85. return TreeNodeList.size();
  86. }
  87. vector<TreeNodeData*> MasterAANodeList::GetTreeNodes() {
  88. return TreeNodeList;
  89. }
  90. EQ2Packet* MasterAAList::GetAAListPacket(Client* client)
  91. {
  92. /*
  93. -- OP_DispatchESMsg --
  94. 5/24/2011 20:54:15
  95. 199.108.12.165 -> 192.168.0.197
  96. 0000: 00 38 3B 00 00 00 FF A3 02 FF FF FF FF 00 00 00 .8;.............
  97. 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  98. 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  99. 0030: 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 ................
  100. 0040 00 .
  101. */
  102. uchar blah[] = {0xFF,0xE8,0x01,
  103. 0x00, //unknown
  104. 0x07,0x00,0x00,0x00, //unknown2
  105. 0x07,0x00,0x57,0x61,0x72,0x72,0x69,0x6F,0x72, //class_title_tab
  106. 0x0C,0x00, //unknown3
  107. 0x64,0x00,0x00,0x00, //max_class_aa
  108. 0xFD,0x74,0xB6,0x73, //class_id
  109. 0x00, //kos_req
  110. 0x00,0x00,0x00,0x00, //num_class_items
  111. 0x0B,0x00,0x00,0x00, //unknown10
  112. 0x11,0x00,0x00,0x00, //class_points_spent
  113. 0x00,0x00,0x3B,0x81,0x01,0x00, //unknown11
  114. 0x00,0x00, //unknown12
  115. 0x00,0x00, //unknown13
  116. 0x00,0x00,0x00,0x00, //unknown14
  117. 0x00,0x00, //unknown15
  118. 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //unknown16
  119. 0x09,0x00,0x42,0x65,0x72,0x73,0x65,0x72,0x6B,0x65,0x72, //subclass_title_tab
  120. 0x0E,0x00, //unknown17
  121. 0x64,0x00,0x00,0x00, //max_subclass_aa
  122. 0x5F,0xD6,0xAF,0x50, //subclass_id
  123. 0x00, //eof_req
  124. 0x00,0x00,0x00,0x00, //num_subclass_items
  125. 0x0C,0x00,0x00,0x00, //unknown20
  126. 0x08,0x00,0x00,0x00, //subclass_points_spent
  127. 0x00,0x00,0x3B,0x81,0x03,0x14, //unknown21
  128. 0x00,0x00,0x00, //unknown22
  129. 0x1D,0x00,0x3A,0x63,0x65,0x31,0x38,0x36,0x34,0x63,0x37,0x66,0x35,0x33,0x66,0x65,0x62,0x37,0x62,0x5F,0x31,0x3A,0x42,0x65,0x72,0x73,0x65,0x72,0x6B,0x65,0x72, //unknown23
  130. 0x01,0x00,0x00,0x00, //unknown24
  131. 0x1D,0x00,0x3A,0x63,0x65,0x31,0x38,0x36,0x34,0x63,0x37,0x35,0x66,0x39,0x34,0x61,0x32,0x64,0x37,0x5F,0x31,0x3A,0x45,0x78,0x70,0x65,0x72,0x74,0x69,0x73,0x65, //unknown25
  132. 0x00,0x00,0x00,0x00,0x00,0x00, //unknown26
  133. 0x07,0x00,0x53,0x68,0x61,0x64,0x6F,0x77,0x73, //shadows_tab_title
  134. 0x2C,0x00, //unknown27
  135. 0x46,0x00,0x00,0x00, //max_shadows_aa
  136. 0x53,0x88,0x59,0x62, //shadows_id
  137. 0x00, //rok_req
  138. 0x00,0x00,0x00,0x00, //num_shadow_items
  139. 0x0E,0x00,0x00,0x00, //unknown30
  140. 0x00,0x00,0x00,0x00, //shadows_points_spent
  141. 0x00,0x00,0x3B,0x81,0x03,0x00, //unknown31
  142. 0x00,0x00,0x00, //unknown32
  143. 0x00,0x00, //uknown33
  144. 0x00,0x00,0x00,0x00, //unknown34
  145. 0x00,0x00, //unknown35
  146. 0x00,0x00,0x00,0x00,0x00,0x00, //unknown36
  147. 0x06,0x00,0x48,0x65,0x72,0x6F,0x69,0x63, //heroic_tab_title
  148. 0x48,0x00, //unknown37
  149. 0x32,0x00,0x00,0x00, //max_heroic_aa
  150. 0xC0,0x6B,0xFC,0x3C, //heroic_id
  151. 0x01, //heroic_dov_req
  152. 0x00,0x00,0x00,0x00, //num_heroic_items
  153. 0x10,0x00,0x00,0x00, //unknown40
  154. 0x00,0x00,0x00,0x00, //heroic_points_spent
  155. 0x00,0x00,0x3B,0x81,0x03,0x00, //unknown41
  156. 0x00,0x00,0x00, //unknown42
  157. 0x00,0x00, //unknown43
  158. 0x00,0x00,0x00,0x00, //unknown44
  159. 0x00,0x00, //unknown45
  160. 0x00,0x00,0x00,0x00,0x00,0x00, //unknown46
  161. 0x0A,0x00,0x54,0x72,0x61,0x64,0x65,0x73,0x6B,0x69,0x6C,0x6C, //tradeskill_tab_title
  162. 0x49,0x00, //unknown47
  163. 0x28,0x00,0x00,0x00, //max_tradeskill_aa
  164. 0x1E,0xDB,0x41,0x2F, //tradeskill_id
  165. 0x00, //exp_req
  166. 0x00,0x00,0x00,0x00, //num_tradeskill_items
  167. 0x00,0x00,0x00,0x00, //unknown50
  168. 0x00,0x00,0x00,0x00, //tradeskill_points_spent
  169. 0x00,0x00,0x3B,0x81,0x03,0x00, //unknown51
  170. 0x00,0x00,0x00, //unknown52
  171. 0x00,0x00, //unknown53
  172. 0x00,0x00,0x00,0x00, //unknown54
  173. 0x00,0x00, //unknown55
  174. 0x03,0x00,0x00,0x00,0x00,0x00, //unknown56
  175. 0x08,0x00,0x50,0x72,0x65,0x73,0x74,0x69,0x67,0x65, //prestige_tab_title
  176. 0x67,0x00, //unknown57
  177. 0x19,0x00,0x00,0x00, //max_prestige_aa
  178. 0xC6,0xA8,0x83,0xBD, //prestige_id
  179. 0x01, //prestige_dov_req
  180. 0x00,0x00,0x00,0x00, //num_prestige_items
  181. 0x10,0x00,0x00,0x00, //unknown60
  182. 0x00,0x00,0x00,0x00, //prestige_points_spent
  183. 0x00,0x00,0x3B,0x81,0x03,0x06, //unknown61
  184. 0x00,0x00,0x00, //unknown62
  185. 0x1D,0x00,0x3A,0x34,0x39,0x33,0x64,0x65,0x62,0x62,0x33,0x65,0x36,0x37,0x38,0x62,0x39,0x37,0x37,0x5F,0x35,0x35,0x3A,0x50,0x72,0x65,0x73,0x74,0x69,0x67,0x65, //unknown63
  186. 0x01,0x00,0x00,0x00, //unknown64
  187. 0x27,0x00,0x3A,0x34,0x39,0x33,0x64,0x65,0x62,0x62,0x33,0x65,0x36,0x61,0x38,0x62,0x62,0x37,0x39,0x5F,0x31,0x32,0x3A,0x50,0x72,0x65,0x73,0x74,0x69,0x67,0x65,0x20,0x45,0x78,0x70,0x65,0x72,0x74,0x69,0x73,0x65, //unknown65
  188. 0x02,0x00,0x00,0x00,0x00,0x00, //unknown66
  189. 0x13,0x00,0x54,0x72,0x61,0x64,0x65,0x73,0x6B,0x69,0x6C,0x6C,0x20,0x50,0x72,0x65,0x73,0x74,0x69,0x67,0x65, //tradeskill_prestige_tab_title
  190. 0x79,0x00, //unknown67
  191. 0x19,0x00,0x00,0x00, //max_tradeskill_prestige_aa
  192. 0x18,0x2C,0x0B,0x74, //tradeskill_prestige_id
  193. 0x01, //coe_req
  194. 0x00,0x00,0x00,0x00, //num_tradeskill_prestige_items
  195. 0x12,0x00,0x00,0x00, //unknown70
  196. 0x00,0x00,0x00,0x00, //tradeskill_prestige_points_spent
  197. 0x00,0x00,0x3B,0x81,0x03,0x00, //unknown71
  198. 0x00,0x00,0x00, //unknown72
  199. 0x00,0x00, //unknown73
  200. 0x00,0x00,0x00,0x00, //unknown74
  201. 0x00,0x00, //unknown75
  202. 0x04,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, //unknown76
  203. 0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //unknown77
  204. 0x01, //num_templates
  205. 0x64, //template_unknown1
  206. 0x03,0x00,0x4E,0x65,0x77, //template_name
  207. 0x00, //template_unknown2
  208. 0x00,0x00}; //num_tabs
  209. return (new EQ2Packet(OP_AdventureList, blah, sizeof(blah)));
  210. }
  211. struct AAEntry {
  212. int8 template_id;
  213. int8 tab_id;
  214. int32 aa_id;
  215. int16 order;
  216. int8 treeid;
  217. };
  218. void MasterAAList::DisplayAA(Client* client,int8 newtemplate,int8 changemode) {
  219. map <int8, int32> AAtree_id;
  220. map <int8, vector<TreeNodeData*> >::iterator itr_tree2;
  221. vector<TreeNodeData*>::iterator itr_tree3;
  222. map <int8, vector<TreeNodeData*> > Nodes;
  223. vector<TreeNodeData*> TreeNodeList = master_tree_nodes.GetTreeNodes();
  224. vector<vector<vector<AAEntry> > > AAEntryList ;
  225. Query query;
  226. MYSQL_ROW row;
  227. int32 Pid = client->GetCharacterID();
  228. AAEntryList.resize(8); // max number of templates
  229. for (int i = 0; i < 8; i++) {
  230. AAEntryList[i].resize(5); // max number of tabs
  231. }
  232. // load templates 1-3 Personal
  233. MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `template_id`,`tab_id`,`aa_id`,`order`,treeid FROM character_aa_defaults where class = %i order by `order`", client->GetPlayer()->GetAdventureClass());
  234. while (result && (row = mysql_fetch_row(result))) {
  235. AAEntry newentry;
  236. newentry.template_id = strtoul(row[0], NULL, 0);
  237. newentry.tab_id = strtoul(row[1], NULL, 0);
  238. newentry.aa_id = strtoul(row[2], NULL, 0);
  239. newentry.order = strtoul(row[3], NULL, 0);
  240. newentry.treeid = strtoul(row[4], NULL, 0);
  241. AAEntryList[newentry.template_id][newentry.tab_id].push_back(newentry);
  242. }
  243. LogWrite(SPELL__INFO, 0, "AA", "Loaded %u AA Tree Nodes", AAEntryList.size());
  244. // load tmplates 4-6 Server
  245. MYSQL_RES* result2 = query.RunQuery2(Q_SELECT, "SELECT `template_id`,`tab_id`,`aa_id`,`order`,treeid FROM character_aa where char_id = %i order by `order`", client->GetCharacterID());
  246. while (result2 && (row = mysql_fetch_row(result2))) {
  247. AAEntry newentry;
  248. newentry.template_id = strtoul(row[0], NULL, 0);
  249. newentry.tab_id = strtoul(row[1], NULL, 0);
  250. newentry.aa_id = strtoul(row[2], NULL, 0);
  251. newentry.order = strtoul(row[3], NULL, 0);
  252. newentry.treeid = strtoul(row[4], NULL, 0);
  253. AAEntryList[newentry.template_id][newentry.tab_id].push_back(newentry);
  254. }
  255. LogWrite(SPELL__INFO, 0, "AA", "Loaded %u AA Tree Nodes", AAEntryList.size());
  256. for (int x = 0; x < TreeNodeList.size(); x++)
  257. {
  258. int8 class_id = client->GetPlayer()->GetInfoStruct()->class3;
  259. if (TreeNodeList[x]->classID == class_id)
  260. {
  261. itr_tree2 = Nodes.lower_bound(TreeNodeList[x]->classID);
  262. if (itr_tree2 != Nodes.end() && !(Nodes.key_comp()(TreeNodeList[x]->classID, itr_tree2->first)))
  263. {
  264. (itr_tree2->second).push_back(TreeNodeList[x]);
  265. LogWrite(SPELL__TRACE, 0, "AA", "Added AA Tree node ID: %u", TreeNodeList[x]->treeID);
  266. }
  267. else
  268. {
  269. vector<TreeNodeData*> tmpVec;
  270. tmpVec.push_back(TreeNodeList[x]);
  271. Nodes.insert(make_pair(TreeNodeList[x]->classID, tmpVec));
  272. LogWrite(SPELL__TRACE, 0, "AA", "Added AA Tree node ID: %u", TreeNodeList[x]->treeID);
  273. }
  274. }
  275. }
  276. map <int8, vector<AltAdvanceData*> >::iterator itr2;
  277. vector<AltAdvanceData*>::iterator itr3;
  278. map <int8, vector<AltAdvanceData*> > ClassTab;
  279. map <int8, vector<AltAdvanceData*> > SubclassTab;
  280. map <int8, vector<AltAdvanceData*> > ShadowsTab;
  281. map <int8, vector<AltAdvanceData*> > HeroicTab;
  282. map <int8, vector<AltAdvanceData*> > TradeskillTab;
  283. map <int8, vector<AltAdvanceData*> > PrestigeTab;
  284. map <int8, vector<AltAdvanceData*> > TradeskillPrestigeTab;
  285. map <int8, vector<AltAdvanceData*> > DragonTab;
  286. map <int8, vector<AltAdvanceData*> > DragonclassTab;
  287. map <int8, vector<AltAdvanceData*> > FarseasTab;
  288. MMasterAAList.readlock(__FUNCTION__, __LINE__);
  289. // Get Tree Node ID's
  290. map <int8, int8> node_id;
  291. map <int8, int32> classid;
  292. for (itr_tree2 = Nodes.begin(); itr_tree2 != Nodes.end(); itr_tree2++) {
  293. int8 x = 0;
  294. for (itr_tree3 = itr_tree2->second.begin(); itr_tree3 != itr_tree2->second.end(); itr_tree3++, x++ ) {
  295. node_id[x] = (*itr_tree3)->treeID;
  296. classid[(*itr_tree3)->treeID] = (*itr_tree3)->AAtreeID;
  297. }
  298. }
  299. int rrr = 0;
  300. for (int i =0; i < Size(); i++) {
  301. if (AAList[i]->group == node_id[AA_CLASS]) {
  302. itr2 = ClassTab.lower_bound(AAList[i]->group);
  303. if (itr2 != ClassTab.end() && !(ClassTab.key_comp()(AAList[i]->group, itr2->first))) {
  304. (itr2->second).push_back(AAList[i]);
  305. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  306. }
  307. else {
  308. vector<AltAdvanceData*> tmpVec;
  309. tmpVec.push_back(AAList[i]);
  310. ClassTab.insert(make_pair(AAList[i]->group, tmpVec));
  311. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  312. }
  313. }
  314. // Sort for Subclass Tab
  315. if (AAList[i]->group == node_id[AA_SUBCLASS]) {
  316. itr2 = SubclassTab.lower_bound(AAList[i]->group);
  317. if (itr2 != SubclassTab.end() && !(SubclassTab.key_comp()(AAList[i]->group, itr2->first))) {
  318. (itr2->second).push_back(AAList[i]);
  319. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  320. }
  321. else {
  322. vector<AltAdvanceData*> tmpVec;
  323. tmpVec.push_back(AAList[i]);
  324. SubclassTab.insert(make_pair(AAList[i]->group, tmpVec));
  325. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  326. }
  327. }
  328. // Sort for Shadows Tab
  329. if (AAList[i]->group == node_id[AA_SHADOW]) {
  330. itr2 = ShadowsTab.lower_bound(AAList[i]->group);
  331. if (itr2 != ShadowsTab.end() && !(ShadowsTab.key_comp()(AAList[i]->group, itr2->first))) {
  332. (itr2->second).push_back(AAList[i]);
  333. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  334. }
  335. else {
  336. vector<AltAdvanceData*> tmpVec;
  337. tmpVec.push_back(AAList[i]);
  338. ShadowsTab.insert(make_pair(AAList[i]->group, tmpVec));
  339. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  340. }
  341. }
  342. // Sort for Heroic Tab
  343. if (AAList[i]->group == node_id[AA_HEROIC]) {
  344. itr2 = HeroicTab.lower_bound(AAList[i]->group);
  345. if (itr2 != HeroicTab.end() && !(HeroicTab.key_comp()(AAList[i]->group, itr2->first))) {
  346. (itr2->second).push_back(AAList[i]);
  347. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  348. }
  349. else {
  350. vector<AltAdvanceData*> tmpVec;
  351. tmpVec.push_back(AAList[i]);
  352. HeroicTab.insert(make_pair(AAList[i]->group, tmpVec));
  353. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  354. }
  355. }
  356. // Sort for Tradeskill Tab
  357. if (AAList[i]->group == node_id[AA_TRADESKILL]) {
  358. itr2 = TradeskillTab.lower_bound(AAList[i]->group);
  359. if (itr2 != TradeskillTab.end() && !(TradeskillTab.key_comp()(AAList[i]->group, itr2->first))) {
  360. (itr2->second).push_back(AAList[i]);
  361. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  362. }
  363. else {
  364. vector<AltAdvanceData*> tmpVec;
  365. tmpVec.push_back(AAList[i]);
  366. TradeskillTab.insert(make_pair(AAList[i]->group, tmpVec));
  367. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  368. }
  369. }
  370. // Sort for Prestige Tab
  371. if (AAList[i]->group == node_id[AA_PRESTIGE]) {
  372. itr2 = PrestigeTab.lower_bound(AAList[i]->group);
  373. if (itr2 != PrestigeTab.end() && !(PrestigeTab.key_comp()(AAList[i]->group, itr2->first))) {
  374. (itr2->second).push_back(AAList[i]);
  375. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  376. }
  377. else {
  378. vector<AltAdvanceData*> tmpVec;
  379. tmpVec.push_back(AAList[i]);
  380. PrestigeTab.insert(make_pair(AAList[i]->group, tmpVec));
  381. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  382. }
  383. }
  384. // Sort for TradeskillPrestige Tab
  385. if (AAList[i]->group == node_id[AA_TRADESKILL_PRESTIGE]) {
  386. itr2 = TradeskillPrestigeTab.lower_bound(AAList[i]->group);
  387. if (itr2 != TradeskillPrestigeTab.end() && !(TradeskillPrestigeTab.key_comp()(AAList[i]->group, itr2->first))) {
  388. (itr2->second).push_back(AAList[i]);
  389. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  390. }
  391. else {
  392. vector<AltAdvanceData*> tmpVec;
  393. tmpVec.push_back(AAList[i]);
  394. TradeskillPrestigeTab.insert(make_pair(AAList[i]->group, tmpVec));
  395. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  396. }
  397. }
  398. // Sort for Dragon Tab
  399. if (AAList[i]->group == node_id[AA_DRAGON]) {
  400. itr2 = DragonTab.lower_bound(AAList[i]->group);
  401. if (itr2 != DragonTab.end() && !(DragonTab.key_comp()(AAList[i]->group, itr2->first))) {
  402. (itr2->second).push_back(AAList[i]);
  403. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  404. }
  405. else {
  406. vector<AltAdvanceData*> tmpVec;
  407. tmpVec.push_back(AAList[i]);
  408. DragonTab.insert(make_pair(AAList[i]->group, tmpVec));
  409. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  410. }
  411. }
  412. // Sort for Dragon Class Tab
  413. if (AAList[i]->group == node_id[AA_DRAGONCLASS]) {
  414. itr2 = DragonclassTab.lower_bound(AAList[i]->group);
  415. if (itr2 != DragonclassTab.end() && !(DragonclassTab.key_comp()(AAList[i]->group, itr2->first))) {
  416. (itr2->second).push_back(AAList[i]);
  417. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  418. }
  419. else {
  420. vector<AltAdvanceData*> tmpVec;
  421. tmpVec.push_back(AAList[i]);
  422. DragonclassTab.insert(make_pair(AAList[i]->group, tmpVec));
  423. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  424. }
  425. }
  426. // Sort for Farseas Tab
  427. if (AAList[i]->group == node_id[AA_FARSEAS]) {
  428. itr2 = FarseasTab.lower_bound(AAList[i]->group);
  429. if (itr2 != FarseasTab.end() && !(FarseasTab.key_comp()(AAList[i]->group, itr2->first))) {
  430. (itr2->second).push_back(AAList[i]);
  431. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  432. }
  433. else {
  434. vector<AltAdvanceData*> tmpVec;
  435. tmpVec.push_back(AAList[i]);
  436. FarseasTab.insert(make_pair(AAList[i]->group, tmpVec));
  437. LogWrite(SPELL__TRACE, 0, "AA", "Added...%u ", AAList[i]->spellID);
  438. }
  439. }
  440. }
  441. MMasterAAList.releasereadlock(__FUNCTION__, __LINE__);
  442. int16 version = 0;
  443. int8 class_num_items = 0;
  444. int8 subclass_num_items = 0;
  445. int8 shadows_num_items = 0;
  446. int8 heroic_num_items = 0;
  447. int8 tradeskill_num_items = 0;
  448. int8 prestige_num_items = 0;
  449. int8 tradeskillprestige_num_items = 0;
  450. int8 dragon_num_items = 0;
  451. int8 dragonclass_num_items = 0;
  452. int8 farseas_num_items = 0;
  453. int8 index = 0;
  454. Spell* spell = 0;
  455. int8 current_rank = 0;
  456. int32 class_node_id = 0;
  457. if (client)
  458. version = client->GetVersion();
  459. PacketStruct* packet = configReader.getStruct("WS_AdventureList", version);
  460. if (version >= 58617) {
  461. packet->setDataByName("num_aa_trees", 10);// number of AA tabs
  462. }
  463. else if (version >= 1193) {
  464. packet->setDataByName("num_aa_trees", 7);// number of AA tabs
  465. }
  466. else if (version >= 1096) {
  467. packet->setDataByName("num_aa_trees", 4);// number of AA tabs
  468. }
  469. // since we do not have a proper way of supporting 3 levels of nested arrays the first array is manual here and not looped
  470. //__________________________________________________________START OF CLASS TREE____________________________________________________________________________________
  471. // Get the value for num_class_items based on size of ClassTab vector
  472. for (itr2 = ClassTab.begin(); itr2 != ClassTab.end(); itr2++) {
  473. class_num_items += (itr2->second).size();
  474. }
  475. LogWrite(SPELL__DEBUG, 0, "AA", "ClassTab Size...%i ", class_num_items);
  476. index = 0;
  477. packet->setDataByName("class_tab_title", classes.GetClassNameCase(classes.GetSecondaryBaseClass(client->GetPlayer()->GetAdventureClass())).c_str());
  478. packet->setDataByName("class_tree_node_id", node_id[AA_CLASS]);
  479. packet->setDataByName("class_max_aa", rule_manager.GetGlobalRule(R_Player, MaxClassAA)->GetInt32());
  480. int32 class_id = TreeNodeList[node_id[AA_CLASS]]->AAtreeID;
  481. class_id = classid[node_id[AA_CLASS]];
  482. packet->setDataByName("class_id", classid[node_id[AA_CLASS]]);
  483. packet->setDataByName("class_kos_req", 0);
  484. packet->setArrayLengthByName("class_num_items", class_num_items,0);
  485. for (itr2 = ClassTab.begin(); itr2 != ClassTab.end(); itr2++) {
  486. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  487. spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  488. current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  489. if (index == 0)
  490. class_node_id = (*itr3)->spellID;
  491. //if (spell) {
  492. packet->setArrayDataByName("class_parent_id", (*itr3)->rankPrereqID, index);
  493. packet->setArrayDataByName("class_req_tier", (*itr3)->rankPrereq, index);
  494. packet->setArrayDataByName("class_spell_id", (*itr3)->spellID, index);
  495. int myrank = (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1);
  496. packet->setArrayDataByName("class_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index); //1= have tier >= 1; 3 = not available for selection; 0 available for selection
  497. packet->setArrayDataByName("class_spell_name", (*itr3)->name.c_str(), index);
  498. packet->setArrayDataByName("class_spell_description", (*itr3)->description.c_str(), index);
  499. packet->setArrayDataByName("class_icon", (*itr3)->icon, index);
  500. packet->setArrayDataByName("class_icon2",(*itr3)->icon2, index);
  501. packet->setArrayDataByName("class_current_rank", current_rank, index); // TODO: need to get this value from the DB
  502. packet->setArrayDataByName("class_max_rank", (*itr3)->maxRank , index);
  503. packet->setArrayDataByName("class_rank_cost", (*itr3)->rankCost, index);
  504. packet->setArrayDataByName("class_min_lev", (*itr3)->min_level, index);
  505. packet->setSubArrayLengthByName("class_unknown5_numitems", 0,index, 0);
  506. //packet->setSubArrayDataByName("class_unknown5", 308397057, index, 0);
  507. //packet->setSubArrayDataByName("class_unknown5", 3215564363, index, 1);
  508. //packet->setSubArrayDataByName("class_unknown5", 445192837, index, 2);
  509. //packet->setSubArrayDataByName("class_unknown5", 3345493294, index, 3);
  510. //packet->setSubArrayDataByName("class_unknown5", 696953971, index, 4);
  511. packet->setArrayDataByName("class_unknown6", 4294967295, index);
  512. packet->setArrayDataByName("class_unknown7", 1, index);
  513. packet->setArrayDataByName("class_classification1", (*itr3)->class_name.c_str(), index);
  514. packet->setArrayDataByName("class_points_req", (*itr3)->req_points, index);
  515. packet->setArrayDataByName("class_unknown8", 0, index);
  516. packet->setArrayDataByName("class_classification2", (*itr3)->subclass_name.c_str(), index);
  517. packet->setArrayDataByName("class_col", (*itr3)->col, index);
  518. packet->setArrayDataByName("class_row", (*itr3)->row, index);
  519. packet->setArrayDataByName("class_line_title", (*itr3)->line_title.c_str(), index);
  520. packet->setArrayDataByName("class_unknown9", ((*itr3)->title_level > 0 ? 258 : 0 ), index);
  521. packet->setArrayDataByName("class_points_to_unlock", (*itr3)->req_tree_points, index);
  522. packet->setArrayDataByName("class_unknown9b", current_rank, index);// aom
  523. //}
  524. //else
  525. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  526. }
  527. }
  528. packet->setDataByName("class_points_spent", 11);
  529. if (version >= 58617) {
  530. packet->setDataByName("class_unknown10", 11);
  531. packet->setDataByName("class_unknown11a", 0);
  532. packet->setDataByName("class_unknown11b", 0);
  533. packet->setDataByName("class_unknown11c", 1);
  534. }
  535. else if (version >= 1193) {
  536. packet->setDataByName("class_unknown10", 11);
  537. packet->setDataByName("class_unknown11", 0, 0);
  538. packet->setDataByName("class_unknown11", 1, 1);
  539. packet->setDataByName("class_unknown11", 1, 2);
  540. }
  541. else if (version >= 1096) {
  542. packet->setDataByName("class_unknown10", 11);
  543. packet->setDataByName("class_unknown11", 0, 0);
  544. packet->setDataByName("class_unknown11", 0, 1);
  545. packet->setDataByName("class_unknown11", 1, 2);
  546. packet->setDataByName("class_unknown11", 0, 3);
  547. packet->setDataByName("class_unknown11", 1, 4);
  548. }
  549. else { // this will change if there is ever a lower client supported
  550. packet->setDataByName("class_unknown10", 11);
  551. packet->setDataByName("class_unknown11", 0, 0);
  552. packet->setDataByName("class_unknown11", 0, 1);
  553. packet->setDataByName("class_unknown11", 1, 2);
  554. packet->setDataByName("class_unknown11", 0, 3);
  555. packet->setDataByName("class_unknown11", 1, 4);
  556. }
  557. //__________________________________________________________START OF SUBCLASS TREE____________________________________________________________________________________
  558. // Get the value for num_class_items based on size of SubclassTab vector
  559. for (itr2 = SubclassTab.begin(); itr2 != SubclassTab.end(); itr2++) {
  560. subclass_num_items += (itr2->second).size();
  561. }
  562. LogWrite(SPELL__DEBUG, 0, "AA", "SubclassTab Size...%i ", subclass_num_items);
  563. index = 0;
  564. packet->setDataByName("subclass_tab_title", classes.GetClassNameCase(client->GetPlayer()->GetAdventureClass()).c_str());
  565. packet->setDataByName("subclass_tree_node_id", node_id[AA_SUBCLASS]);
  566. packet->setDataByName("subclass_max_aa", rule_manager.GetGlobalRule(R_Player, MaxSubclassAA)->GetInt32());
  567. int32 unknown3 = TreeNodeList[node_id[AA_SUBCLASS]]->AAtreeID;
  568. packet->setDataByName("subclass_id", classid[node_id[AA_SUBCLASS]]);
  569. packet->setDataByName("subclass_eof_req", 0);
  570. packet->setArrayLengthByName("subclass_num_items", subclass_num_items, 0);
  571. for (itr2 = SubclassTab.begin(); itr2 != SubclassTab.end(); itr2++) {
  572. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  573. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  574. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  575. if (index == 0)
  576. class_node_id = (*itr3)->spellID;
  577. //if (spell) {
  578. packet->setArrayDataByName("subclass_parent_id", (*itr3)->rankPrereqID, index);
  579. packet->setArrayDataByName("subclass_req_tier", (*itr3)->rankPrereq, index);
  580. packet->setArrayDataByName("subclass_spell_id", (*itr3)->spellID, index);
  581. packet->setArrayDataByName("subclass_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  582. packet->setArrayDataByName("subclass_spell_name", (*itr3)->name.c_str(), index);
  583. packet->setArrayDataByName("subclass_spell_description", (*itr3)->description.c_str(), index);
  584. packet->setArrayDataByName("subclass_icon", (*itr3)->icon, index);
  585. packet->setArrayDataByName("subclass_icon2", (*itr3)->icon2, index);
  586. packet->setArrayDataByName("subclass_current_rank", current_rank, index); // TODO: need to get this value from the DB
  587. packet->setArrayDataByName("subclass_max_rank", (*itr3)->maxRank, index);
  588. packet->setArrayDataByName("subclass_rank_cost", (*itr3)->rankCost, index);
  589. packet->setArrayDataByName("subclass_min_lev", (*itr3)->min_level, index);
  590. packet->setSubArrayLengthByName("subclass_unknown5_numitems", 0,index,0);
  591. //packet->setSubArrayDataByName("subclass_unknown5", 308397057, index, 0);
  592. //packet->setSubArrayDataByName("subclass_unknown5", 3215564363, index, 1);
  593. //packet->setSubArrayDataByName("subclass_unknown5", 445192837, index, 2);
  594. //packet->setSubArrayDataByName("subclass_unknown5", 3345493294, index, 3);
  595. //packet->setSubArrayDataByName("subclass_unknown5", 696953971, index, 4);
  596. packet->setArrayDataByName("subclass_unknown6", 4294967295, index);
  597. packet->setArrayDataByName("subclass_unknown7", 1, index);
  598. packet->setArrayDataByName("subclass_classification1", (*itr3)->class_name.c_str(), index);
  599. packet->setArrayDataByName("subclass_points_req", (*itr3)->req_points, index);
  600. packet->setArrayDataByName("subclass_unknown8", 0, index);
  601. packet->setArrayDataByName("subclass_classification2", (*itr3)->subclass_name.c_str(), index);
  602. packet->setArrayDataByName("subclass_col", (*itr3)->col, index);
  603. packet->setArrayDataByName("subclass_row", (*itr3)->row, index);
  604. packet->setArrayDataByName("subclass_line_title", (*itr3)->line_title.c_str(), index);
  605. packet->setArrayDataByName("subclass_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  606. packet->setArrayDataByName("subclass_points_to_unlock", (*itr3)->req_tree_points, index);
  607. packet->setArrayDataByName("subclass_unknown9b", 0, index); //added with 68617 AOM something to do with points
  608. //}
  609. //else
  610. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  611. }
  612. }
  613. packet->setDataByName("subclass_points_spent", 12); // to change the 34 to a track value
  614. if (version >= 58617) {
  615. packet->setDataByName("subclass_unknown10", 12);
  616. packet->setDataByName("subclass_unknown11a", 0);
  617. packet->setDataByName("subclass_unknown11b", 50386);
  618. packet->setDataByName("subclass_unknown11c", 5123);
  619. packet->setDataByName("subclass_unknown12", 0, 0);
  620. packet->setDataByName("subclass_unknown12", 0, 1);
  621. packet->setDataByName("subclass_unknown12", 0, 2);
  622. packet->setDataByName("subclass_unknown13",":493debb3e678b977_91:test_unknown13");// this is based on class
  623. packet->setDataByName("subclass_unknown14", 1);
  624. packet->setDataByName("subclass_unknown15", ":ce1864c75f94a2d7_14:Expertise");
  625. packet->setDataByName("subclass_unknown16", 0, 0);
  626. packet->setDataByName("subclass_unknown16", 0, 1);
  627. packet->setDataByName("subclass_unknown16", 0, 2);
  628. packet->setDataByName("subclass_unknown16", 0, 3);
  629. packet->setDataByName("subclass_unknown16", 0, 4);
  630. packet->setDataByName("subclass_unknown16", 0, 5);
  631. }
  632. else if (version >= 1193) {
  633. packet->setDataByName("subclass_unknown10", 12);
  634. packet->setDataByName("subclass_unknown11", 0, 0);
  635. packet->setDataByName("subclass_unknown11", 1, 1);
  636. packet->setDataByName("subclass_unknown11", 5123, 2);
  637. packet->setDataByName("subclass_unknown12", 0, 0);
  638. packet->setDataByName("subclass_unknown12", 0, 1);
  639. packet->setDataByName("subclass_unknown12", 0, 2);
  640. packet->setDataByName("subclass_unknown13", ":493debb3e678b977_91:test_unknown13");// this is based on class
  641. packet->setDataByName("subclass_unknown14", 1);
  642. packet->setDataByName("subclass_unknown15", ":ce1864c75f94a2d7_14:Expertise");
  643. packet->setDataByName("subclass_unknown16", 111, 0);
  644. packet->setDataByName("subclass_unknown16", 108, 1);
  645. packet->setDataByName("subclass_unknown16", 108, 2);
  646. packet->setDataByName("subclass_unknown16", 1101, 3);
  647. packet->setDataByName("subclass_unknown16", 121, 4);
  648. packet->setDataByName("subclass_unknown16", 129, 5);
  649. }
  650. else if (version >= 1096) {
  651. packet->setDataByName("subclass_unknown10", 12);
  652. packet->setDataByName("subclass_unknown11", 0, 0);
  653. packet->setDataByName("subclass_unknown11", 0, 1);
  654. packet->setDataByName("subclass_unknown11", 1, 2);
  655. packet->setDataByName("subclass_unknown11", 0, 3);
  656. packet->setDataByName("subclass_unknown11", 3, 4);
  657. }
  658. else { // this will change if there is ever a lower client supported
  659. packet->setDataByName("subclass_unknown10", 12);
  660. packet->setDataByName("subclass_unknown11", 0, 0);
  661. packet->setDataByName("subclass_unknown11", 0, 1);
  662. packet->setDataByName("subclass_unknown11", 1, 2);
  663. packet->setDataByName("subclass_unknown11", 0, 3);
  664. packet->setDataByName("subclass_unknown11", 3, 4);
  665. }
  666. //__________________________________________________________START OF SHADOWS TREE____________________________________________________________________________________
  667. for (itr2 = ShadowsTab.begin(); itr2 != ShadowsTab.end(); itr2++) {
  668. shadows_num_items += (itr2->second).size();
  669. }
  670. LogWrite(SPELL__DEBUG, 0, "AA", "ShadowsTab Size...%i ", shadows_num_items);
  671. index = 0;
  672. packet->setDataByName("shadows_tab_title", "Shadows");
  673. packet->setDataByName("shadows_tree_node_id", node_id[AA_SHADOW]);
  674. packet->setDataByName("shadows_max_aa", rule_manager.GetGlobalRule(R_Player, MaxShadowsAA)->GetInt32());
  675. packet->setDataByName("shadows_id", classid[node_id[AA_SHADOW]]);
  676. packet->setDataByName("shadows_eof_req", 0);
  677. packet->setArrayLengthByName("shadows_num_items", shadows_num_items, 0);
  678. //packet->PrintPacket();
  679. for (itr2 = ShadowsTab.begin(); itr2 != ShadowsTab.end(); itr2++) {
  680. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  681. spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  682. current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  683. if (index == 0)
  684. class_node_id = (*itr3)->spellID;
  685. //if (spell) {
  686. packet->setArrayDataByName("shadows_parent_id", (*itr3)->rankPrereqID, index);
  687. packet->setArrayDataByName("shadows_req_tier", (*itr3)->rankPrereq, index);
  688. packet->setArrayDataByName("shadows_spell_id", (*itr3)->spellID, index);
  689. packet->setArrayDataByName("shadows_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  690. packet->setArrayDataByName("shadows_spell_name", (*itr3)->name.c_str(), index);
  691. packet->setArrayDataByName("shadows_spell_description", (*itr3)->description.c_str(), index);
  692. packet->setArrayDataByName("shadows_icon", (*itr3)->icon, index);
  693. packet->setArrayDataByName("shadows_icon2", (*itr3)->icon2, index);
  694. packet->setArrayDataByName("shadows_current_rank", current_rank, index); // TODO: need to get this value from the DB
  695. packet->setArrayDataByName("shadows_max_rank", (*itr3)->maxRank, index);
  696. packet->setArrayDataByName("shadows_rank_cost", (*itr3)->rankCost, index);
  697. packet->setArrayDataByName("shadows_min_lev", (*itr3)->min_level, index);
  698. packet->setSubArrayLengthByName("shadows_unknown5_num_items", 0, index, 0);
  699. //packet->setSubArrayDataByName("shadows_unknown5", 308397057, index, 0);
  700. //packet->setSubArrayDataByName("shadows_unknown5", 3215564363, index, 1);
  701. //packet->setSubArrayDataByName("shadows_unknown5", 445192837, index, 2);
  702. //packet->setSubArrayDataByName("shadows_unknown5", 3345493294, index, 3);
  703. //packet->setSubArrayDataByName("shadows_unknown5", 696953971, index, 4);
  704. packet->setArrayDataByName("shadows_unknown6", 4294967295, index);
  705. packet->setArrayDataByName("shadows_unknown7", 1, index);
  706. packet->setArrayDataByName("shadows_classification1", (*itr3)->class_name.c_str(), index);
  707. packet->setArrayDataByName("shadows_points_req", (*itr3)->req_points, index);
  708. packet->setArrayDataByName("shadows_unknown8", 0, index);
  709. packet->setArrayDataByName("shadows_classification2", (*itr3)->subclass_name.c_str(), index);
  710. packet->setArrayDataByName("shadows_col", (*itr3)->col, index);
  711. packet->setArrayDataByName("shadows_row", (*itr3)->row, index);
  712. packet->setArrayDataByName("shadows_line_title", (*itr3)->line_title.c_str(), index);
  713. packet->setArrayDataByName("shadows_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  714. packet->setArrayDataByName("shadows_points_to_unlock", (*itr3)->req_tree_points, index);
  715. packet->setArrayDataByName("shadows_unknown9b", 0, index);
  716. //}
  717. //else
  718. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  719. }
  720. }
  721. packet->setDataByName("shadows_points_spent", 14);
  722. if (version >= 58617) {
  723. packet->setDataByName("shadows_unknown10", 14);
  724. packet->setDataByName("shadows_unknown11a", 0);
  725. packet->setDataByName("shadows_unknown11b", 50386);
  726. packet->setDataByName("shadows_unknown11c", 3);
  727. packet->setDataByName("shadows_unknown12", 0, 0);
  728. packet->setDataByName("shadows_unknown12", 0, 1);
  729. packet->setDataByName("shadows_unknown12", 0, 2);
  730. }
  731. else if (version >= 1193) {
  732. packet->setDataByName("shadows_unknown10", 14);
  733. packet->setDataByName("shadows_unknown11", 0, 0);
  734. packet->setDataByName("shadows_unknown11", 1, 1);
  735. packet->setDataByName("shadows_unknown11", 3, 2);
  736. packet->setDataByName("shadows_unknown12", 0, 0);
  737. packet->setDataByName("shadows_unknown12", 0, 1);
  738. packet->setDataByName("shadows_unknown12", 0, 2);
  739. }
  740. else if (version >= 1096) {
  741. packet->setDataByName("shadows_unknown11", 0, 0);
  742. packet->setDataByName("shadows_unknown11", 0, 1);
  743. packet->setDataByName("shadows_unknown11", 1, 2);
  744. packet->setDataByName("shadows_unknown11", 0, 3);
  745. packet->setDataByName("shadows_unknown11", 3, 4);
  746. }
  747. else { // this will change if there is ever a lower client supported
  748. packet->setDataByName("shadows_unknown11", 0, 0);
  749. packet->setDataByName("shadows_unknown11", 0, 1);
  750. packet->setDataByName("shadows_unknown11", 1, 2);
  751. packet->setDataByName("shadows_unknown11", 0, 3);
  752. packet->setDataByName("shadows_unknown11", 3, 4);
  753. packet->setDataByName("shadows_unknown12", 103, 0);
  754. packet->setDataByName("shadows_unknown12", 101, 1);
  755. packet->setDataByName("shadows_unknown12", 114, 2);
  756. packet->setDataByName("shadows_unknown14", 1835365408);
  757. packet->setDataByName("shadows_unknown16", 114, 0);
  758. packet->setDataByName("shadows_unknown16", 97, 1);
  759. packet->setDataByName("shadows_unknown16", 114, 2);
  760. packet->setDataByName("shadows_unknown16", 121, 3);
  761. packet->setDataByName("shadows_unknown16", 32, 4);
  762. packet->setDataByName("shadows_unknown16", 98, 5);
  763. }
  764. //__________________________________________________________START OF HEROIC TREE____________________________________________________________________________________
  765. for (itr2 = HeroicTab.begin(); itr2 != HeroicTab.end(); itr2++) {
  766. heroic_num_items += (itr2->second).size();
  767. }
  768. LogWrite(SPELL__DEBUG, 0, "AA", "HeroicTab Size...%i ", heroic_num_items);
  769. index = 0;
  770. packet->setDataByName("heroic_tab_title", "Heroic");
  771. packet->setDataByName("heroic_tree_node_id", node_id[AA_HEROIC]);
  772. packet->setDataByName("heroic_max_aa", rule_manager.GetGlobalRule(R_Player, MaxHeroicAA)->GetInt32());
  773. packet->setDataByName("heroic_id", classid[node_id[AA_HEROIC]]);
  774. packet->setDataByName("heroic_eof_req", 0);
  775. packet->setArrayLengthByName("heroic_num_items", heroic_num_items, 0);
  776. for (itr2 = HeroicTab.begin(); itr2 != HeroicTab.end(); itr2++) {
  777. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  778. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  779. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  780. if (index == 0)
  781. class_node_id = (*itr3)->spellID;
  782. //if (spell) {
  783. packet->setArrayDataByName("heroic_parent_id", (*itr3)->rankPrereqID, index);
  784. packet->setArrayDataByName("heroic_req_tier", (*itr3)->rankPrereq, index);
  785. packet->setArrayDataByName("heroic_spell_id", (*itr3)->spellID, index);
  786. packet->setArrayDataByName("heroic_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  787. packet->setArrayDataByName("heroic_spell_name", (*itr3)->name.c_str(), index);
  788. packet->setArrayDataByName("heroic_spell_description", (*itr3)->description.c_str(), index);
  789. packet->setArrayDataByName("heroic_icon", (*itr3)->icon, index);
  790. packet->setArrayDataByName("heroic_icon2", (*itr3)->icon2, index);
  791. packet->setArrayDataByName("heroic_current_rank", current_rank, index); // TODO: need to get this value from the DB
  792. packet->setArrayDataByName("heroic_max_rank", (*itr3)->maxRank, index);
  793. packet->setArrayDataByName("heroic_rank_cost", (*itr3)->rankCost, index);
  794. packet->setArrayDataByName("heroic_min_lev", (*itr3)->min_level, index);
  795. packet->setSubArrayLengthByName("heroic_unknown5_num_items", 0, index, 0);
  796. //packet->setSubArrayDataByName("heroic_unknown5", 308397057, index, 0);
  797. //packet->setSubArrayDataByName("heroic_unknown5", 3215564363, index, 1);
  798. //packet->setSubArrayDataByName("heroic_unknown5", 445192837, index, 2);
  799. //packet->setSubArrayDataByName("heroic_unknown5", 3345493294, index, 3);
  800. //packet->setSubArrayDataByName("heroic_unknown5", 696953971, index, 4);
  801. packet->setArrayDataByName("heroic_unknown6", 4294967295, index);
  802. packet->setArrayDataByName("heroic_unknown7", 1, index);
  803. packet->setArrayDataByName("heroic_classification1", (*itr3)->class_name.c_str(), index);
  804. packet->setArrayDataByName("heroic_points_req", (*itr3)->req_points, index);
  805. packet->setArrayDataByName("heroic_unknown8", 0, index);
  806. packet->setArrayDataByName("heroic_classification2", (*itr3)->subclass_name.c_str(), index);
  807. packet->setArrayDataByName("heroic_col", (*itr3)->col, index);
  808. packet->setArrayDataByName("heroic_row", (*itr3)->row, index);
  809. packet->setArrayDataByName("heroic_line_title", (*itr3)->line_title.c_str(), index);
  810. packet->setArrayDataByName("heroic_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  811. packet->setArrayDataByName("heroic_points_to_unlock", (*itr3)->req_tree_points, index);
  812. packet->setArrayDataByName("heroic_unknown9b", 0, index);
  813. //}
  814. //else
  815. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  816. }
  817. }
  818. packet->setDataByName("heroic_points_spent", 16);
  819. if (version >= 58617) {
  820. packet->setDataByName("heroic_unknown10", 16);
  821. packet->setDataByName("heroic_unknown11a", 0);
  822. packet->setDataByName("heroic_unknown11b", 50386);
  823. packet->setDataByName("heroic_unknown11c", 3);
  824. packet->setDataByName("heroic_unknown12", 0, 0);
  825. packet->setDataByName("heroic_unknown12", 0, 1);
  826. packet->setDataByName("heroic_unknown12", 0, 2);
  827. packet->setDataByName("heroic_unknown14", 0);
  828. packet->setDataByName("heroic_unknown16", 39, 0);
  829. packet->setDataByName("heroic_unknown16", 115, 1);
  830. packet->setDataByName("heroic_unknown16", 32, 2);
  831. packet->setDataByName("heroic_unknown16", 115, 3);
  832. packet->setDataByName("heroic_unknown16", 101, 4);
  833. packet->setDataByName("heroic_unknown16", 108, 5);
  834. }
  835. else if (version >= 1193) {
  836. packet->setDataByName("heroic_unknown10", 16);
  837. packet->setDataByName("heroic_unknown11", 0, 0);
  838. packet->setDataByName("heroic_unknown11", 1, 1);
  839. packet->setDataByName("heroic_unknown11", 3, 2);
  840. packet->setDataByName("heroic_unknown12", 0, 0);
  841. packet->setDataByName("heroic_unknown12", 0, 1);
  842. packet->setDataByName("heroic_unknown12", 0, 2);
  843. packet->setDataByName("heroic_unknown14", 0);
  844. packet->setDataByName("heroic_unknown16", 0, 0);
  845. packet->setDataByName("heroic_unknown16", 0, 1);
  846. packet->setDataByName("heroic_unknown16", 0, 2);
  847. packet->setDataByName("heroic_unknown16", 0, 3);
  848. packet->setDataByName("heroic_unknown16", 0, 4);
  849. packet->setDataByName("heroic_unknown16", 0, 5);
  850. }
  851. else if (version >= 1096) {
  852. packet->setDataByName("heroic_unknown11", 0, 0);
  853. packet->setDataByName("heroic_unknown11", 0, 1);
  854. packet->setDataByName("heroic_unknown11", 1, 2);
  855. packet->setDataByName("heroic_unknown11", 0, 3);
  856. packet->setDataByName("heroic_unknown11", 3, 4);
  857. }
  858. else { // this will change if there is ever a lower client supported
  859. packet->setDataByName("heroic_unknown11", 0, 0);
  860. packet->setDataByName("heroic_unknown11", 0, 1);
  861. packet->setDataByName("heroic_unknown11", 1, 2);
  862. packet->setDataByName("heroic_unknown11", 0, 3);
  863. packet->setDataByName("heroic_unknown11", 3, 4);
  864. }
  865. if (version >= 1193) {
  866. //__________________________________________________________START OF TRADESKILL TREE____________________________________________________________________________________
  867. for (itr2 = TradeskillTab.begin(); itr2 != TradeskillTab.end(); itr2++) {
  868. tradeskill_num_items += (itr2->second).size();
  869. }
  870. LogWrite(SPELL__DEBUG, 0, "AA", "TradeskillTab Size...%i ", tradeskill_num_items);
  871. index = 0;
  872. packet->setDataByName("tradeskill_tab_title", "Tradeskill");
  873. packet->setDataByName("tradeskill_tree_node_id", node_id[AA_TRADESKILL]);
  874. packet->setDataByName("tradeskill_max_aa", rule_manager.GetGlobalRule(R_Player, MaxTradeskillAA)->GetInt32());
  875. packet->setDataByName("tradeskill_id", classid[node_id[AA_TRADESKILL]]);
  876. packet->setDataByName("tradeskill_eof_req", 0);
  877. packet->setArrayLengthByName("tradeskill_num_items", tradeskill_num_items, 0);
  878. for (itr2 = TradeskillTab.begin(); itr2 != TradeskillTab.end(); itr2++) {
  879. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  880. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  881. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  882. if (index == 0)
  883. class_node_id = (*itr3)->spellID;
  884. //if (spell) {
  885. packet->setArrayDataByName("tradeskill_parent_id", (*itr3)->rankPrereqID, index);
  886. packet->setArrayDataByName("tradeskill_req_tier", (*itr3)->rankPrereq, index);
  887. packet->setArrayDataByName("tradeskill_spell_id", (*itr3)->spellID, index);
  888. packet->setArrayDataByName("tradeskill_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  889. packet->setArrayDataByName("tradeskill_spell_name", (*itr3)->name.c_str(), index);
  890. packet->setArrayDataByName("tradeskill_spell_description", (*itr3)->description.c_str(), index);
  891. packet->setArrayDataByName("tradeskill_icon", (*itr3)->icon, index);
  892. packet->setArrayDataByName("tradeskill_icon2", (*itr3)->icon2, index);
  893. packet->setArrayDataByName("tradeskill_current_rank", current_rank, index); // TODO: need to get this value from the DB
  894. packet->setArrayDataByName("tradeskill_max_rank", (*itr3)->maxRank, index);
  895. packet->setArrayDataByName("tradeskill_rank_cost", (*itr3)->rankCost, index);
  896. packet->setArrayDataByName("tradeskill_min_lev", (*itr3)->min_level, index);
  897. packet->setSubArrayLengthByName("tradeskill_unknown5_num_items", 0, index, 0);
  898. //packet->setSubArrayDataByName("tradeskill_unknown5", 308397057, index, 0);
  899. //packet->setSubArrayDataByName("tradeskill_unknown5", 3215564363, index, 1);
  900. //packet->setSubArrayDataByName("tradeskill_unknown5", 445192837, index, 2);
  901. //packet->setSubArrayDataByName("tradeskill_unknown5", 3345493294, index, 3);
  902. //packet->setSubArrayDataByName("tradeskill_unknown5", 696953971, index, 4);
  903. packet->setArrayDataByName("tradeskill_unknown6", 4294967295, index);
  904. packet->setArrayDataByName("tradeskill_unknown7", 0, index);
  905. packet->setArrayDataByName("tradeskill_classification1", (*itr3)->class_name.c_str(), index);
  906. packet->setArrayDataByName("tradeskill_points_req", (*itr3)->req_points, index);
  907. packet->setArrayDataByName("tradeskill_unknown8", 0, index);
  908. packet->setArrayDataByName("tradeskill_classification2", (*itr3)->subclass_name.c_str(), index);
  909. packet->setArrayDataByName("tradeskill_col", (*itr3)->col, index);
  910. packet->setArrayDataByName("tradeskill_row", (*itr3)->row, index);
  911. packet->setArrayDataByName("tradeskill_line_title", (*itr3)->line_title.c_str(), index);
  912. packet->setArrayDataByName("tradeskill_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  913. packet->setArrayDataByName("tradeskill_points_to_unlock", (*itr3)->req_tree_points, index);
  914. packet->setArrayDataByName("tradeskill_unknown9b", 0, index);
  915. //}
  916. //else
  917. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  918. }
  919. }
  920. packet->setDataByName("tradeskill_unknown10", 0);
  921. packet->setDataByName("tradeskill_points_spent", 22);
  922. if (version >= 58617) {
  923. packet->setDataByName("tradeskill_unknown10", 11);
  924. packet->setDataByName("tradeskill_unknown11a", 0);
  925. packet->setDataByName("tradeskill_unknown11b", 50386);
  926. packet->setDataByName("tradeskill_unknown11c", 3);
  927. packet->setDataByName("tradeskill_unknown12", 0, 0);
  928. packet->setDataByName("tradeskill_unknown12", 0, 1);
  929. packet->setDataByName("tradeskill_unknown12", 0, 2);
  930. packet->setDataByName("tradeskill_unknown14", 0);
  931. packet->setDataByName("tradeskill_unknown16", 3, 0);
  932. packet->setDataByName("tradeskill_unknown16", 0, 1);
  933. packet->setDataByName("tradeskill_unknown16", 0, 2);
  934. packet->setDataByName("tradeskill_unknown16", 0, 3);
  935. packet->setDataByName("tradeskill_unknown16", 0, 4);
  936. packet->setDataByName("tradeskill_unknown16", 0, 5);
  937. }
  938. else if (version >= 1193) {
  939. packet->setDataByName("tradeskill_unknown10", 0);
  940. packet->setDataByName("tradeskill_unknown11", 0, 0);
  941. packet->setDataByName("tradeskill_unknown11", 1, 1);
  942. packet->setDataByName("tradeskill_unknown11", 3, 2);
  943. packet->setDataByName("tradeskill_unknown12", 0, 0);
  944. packet->setDataByName("tradeskill_unknown12", 0, 1);
  945. packet->setDataByName("tradeskill_unknown12", 0, 2);
  946. packet->setDataByName("tradeskill_unknown14", 0);
  947. packet->setDataByName("tradeskill_unknown16", 3, 0);
  948. packet->setDataByName("tradeskill_unknown16", 0, 1);
  949. packet->setDataByName("tradeskill_unknown16", 0, 2);
  950. packet->setDataByName("tradeskill_unknown16", 0, 3);
  951. packet->setDataByName("tradeskill_unknown16", 0, 4);
  952. packet->setDataByName("tradeskill_unknown16", 0, 5);
  953. }
  954. //__________________________________________________________START OF PRESTIGE TREE____________________________________________________________________________________
  955. for (itr2 = PrestigeTab.begin(); itr2 != PrestigeTab.end(); itr2++) {
  956. prestige_num_items += (itr2->second).size();
  957. }
  958. LogWrite(SPELL__DEBUG, 0, "AA", "PrestigeTab Size...%i ", prestige_num_items);
  959. index = 0;
  960. packet->setDataByName("prestige_tab_title", "Prestige");
  961. packet->setDataByName("prestige_tree_node_id", node_id[AA_PRESTIGE]);
  962. packet->setDataByName("prestige_max_aa", rule_manager.GetGlobalRule(R_Player, MaxPrestigeAA)->GetInt32());
  963. packet->setDataByName("prestige_id", classid[node_id[AA_PRESTIGE]]);
  964. packet->setDataByName("prestige_eof_req", 0);
  965. packet->setArrayLengthByName("prestige_num_items", prestige_num_items, 0);
  966. for (itr2 = PrestigeTab.begin(); itr2 != PrestigeTab.end(); itr2++) {
  967. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  968. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  969. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  970. if (index == 0)
  971. class_node_id = (*itr3)->spellID;
  972. //if (spell) {
  973. packet->setArrayDataByName("prestige_parent_id", (*itr3)->rankPrereqID, index);
  974. packet->setArrayDataByName("prestige_req_tier", (*itr3)->rankPrereq, index);
  975. packet->setArrayDataByName("prestige_spell_id", (*itr3)->spellID, index);
  976. packet->setArrayDataByName("prestige_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  977. packet->setArrayDataByName("prestige_spell_name", (*itr3)->name.c_str(), index);
  978. packet->setArrayDataByName("prestige_spell_description", (*itr3)->description.c_str(), index);
  979. packet->setArrayDataByName("prestige_icon", (*itr3)->icon, index);
  980. packet->setArrayDataByName("prestige_icon2", (*itr3)->icon2, index);
  981. packet->setArrayDataByName("prestige_current_rank", current_rank, index); // TODO: need to get this value from the DB
  982. packet->setArrayDataByName("prestige_max_rank", (*itr3)->maxRank, index);
  983. packet->setArrayDataByName("prestige_rank_cost", (*itr3)->rankCost, index);
  984. packet->setArrayDataByName("prestige_min_lev", (*itr3)->min_level, index);
  985. packet->setSubArrayLengthByName("prestige_unknown5_num_items", 0, index, 0);
  986. //packet->setSubArrayDataByName("prestige_unknown5", 308397057, index, 0);
  987. //packet->setSubArrayDataByName("prestige_unknown5", 3215564363, index, 1);
  988. //packet->setSubArrayDataByName("prestige_unknown5", 445192837, index, 2);
  989. //packet->setSubArrayDataByName("prestige_unknown5", 3345493294, index, 3);
  990. //packet->setSubArrayDataByName("prestige_unknown5", 696953971, index, 4);
  991. packet->setArrayDataByName("prestige_unknown6", 4294967295, index);
  992. packet->setArrayDataByName("prestige_unknown7", 1, index);
  993. packet->setArrayDataByName("prestige_classification1", (*itr3)->class_name.c_str(), index);
  994. packet->setArrayDataByName("prestige_points_req", (*itr3)->req_points, index);
  995. packet->setArrayDataByName("prestige_unknown8", 0, index);
  996. packet->setArrayDataByName("prestige_classification2", (*itr3)->subclass_name.c_str(), index);
  997. packet->setArrayDataByName("prestige_col", (*itr3)->col, index);
  998. packet->setArrayDataByName("prestige_row", (*itr3)->row, index);
  999. packet->setArrayDataByName("prestige_line_title", (*itr3)->line_title.c_str(), index);
  1000. packet->setArrayDataByName("prestige_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  1001. packet->setArrayDataByName("prestige_points_to_unlock", (*itr3)->req_tree_points, index);
  1002. packet->setArrayDataByName("prestige_unknown9b", 0, index);
  1003. //}
  1004. //else
  1005. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  1006. }
  1007. }
  1008. packet->setDataByName("prestige_points_spent", 34);
  1009. if (version >= 58617) {
  1010. packet->setDataByName("prestige_unknown10", 16);
  1011. packet->setDataByName("prestige_unknown11a", 0);
  1012. packet->setDataByName("prestige_unknown11b", 50386);
  1013. packet->setDataByName("prestige_unknown11c", 1539);
  1014. packet->setDataByName("prestige_unknown12", 0, 0);
  1015. packet->setDataByName("prestige_unknown12", 0, 1);
  1016. packet->setDataByName("prestige_unknown12", 0, 2);
  1017. packet->setDataByName("prestige_unknown13", ":493debb3e678b977_91:Prestige");
  1018. packet->setDataByName("prestige_unknown14", 1);
  1019. packet->setDataByName("prestige_unknown15", ":493debb3e6a8bb79_20:Prestige Expertise");
  1020. packet->setDataByName("prestige_unknown16", 2, 0);
  1021. packet->setDataByName("prestige_unknown16", 0, 1);
  1022. packet->setDataByName("prestige_unknown16", 0, 2);
  1023. packet->setDataByName("prestige_unknown16", 0, 3);
  1024. packet->setDataByName("prestige_unknown16", 0, 4);
  1025. packet->setDataByName("prestige_unknown16", 0, 5);
  1026. }
  1027. else if (version >= 1193) {
  1028. packet->setDataByName("prestige_unknown10", 16);
  1029. packet->setDataByName("prestige_unknown11", 0, 0);
  1030. packet->setDataByName("prestige_unknown11", 1, 1);
  1031. packet->setDataByName("prestige_unknown11", 1539, 2);
  1032. packet->setDataByName("prestige_unknown12", 0, 0);
  1033. packet->setDataByName("prestige_unknown12", 0, 1);
  1034. packet->setDataByName("prestige_unknown12", 0, 2);
  1035. packet->setDataByName("prestige_unknown13", ":493debb3e678b977_91:Prestige");
  1036. packet->setDataByName("prestige_unknown14", 1);
  1037. packet->setDataByName("prestige_unknown15", ":493debb3e6a8bb79_20:Prestige Expertise");
  1038. packet->setDataByName("prestige_unknown16", 2, 0);
  1039. packet->setDataByName("prestige_unknown16", 0, 1);
  1040. packet->setDataByName("prestige_unknown16", 0, 2);
  1041. packet->setDataByName("prestige_unknown16", 0, 3);
  1042. packet->setDataByName("prestige_unknown16", 0, 4);
  1043. packet->setDataByName("prestige_unknown16", 0, 5);
  1044. }
  1045. //__________________________________________________________START OF TRADESKILL PRESTIGE TREE____________________________________________________________________________________
  1046. for (itr2 = TradeskillPrestigeTab.begin(); itr2 != TradeskillPrestigeTab.end(); itr2++) {
  1047. tradeskillprestige_num_items += (itr2->second).size();
  1048. }
  1049. LogWrite(SPELL__DEBUG, 0, "AA", "TradeskillPrestigeTab Size...%i ", tradeskillprestige_num_items);
  1050. index = 0;
  1051. if (version >= 58617) {
  1052. packet->setDataByName("tradeskillprestige_tab_title", "General");
  1053. }
  1054. else {
  1055. packet->setDataByName("tradeskillprestige_tab_title", "Tradeskill Prestige");
  1056. }
  1057. packet->setDataByName("tradeskillprestige_tree_node_id", node_id[AA_TRADESKILL_PRESTIGE]);
  1058. packet->setDataByName("tradeskillprestige_max_aa", rule_manager.GetGlobalRule(R_Player, MaxPrestigeAA)->GetInt32());
  1059. packet->setDataByName("tradeskillprestige_id", classid[node_id[AA_TRADESKILL_PRESTIGE]]);
  1060. packet->setDataByName("tradeskillprestige_eof_req", 0);
  1061. packet->setArrayLengthByName("tradeskillprestige_num_items", tradeskillprestige_num_items, 0);
  1062. for (itr2 = PrestigeTab.begin(); itr2 != PrestigeTab.end(); itr2++) {
  1063. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  1064. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  1065. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  1066. if (index == 0)
  1067. class_node_id = (*itr3)->spellID;
  1068. //if (spell) {
  1069. packet->setArrayDataByName("tradeskillprestige_parent_id", (*itr3)->rankPrereqID, index);
  1070. packet->setArrayDataByName("tradeskillprestige_req_tier", (*itr3)->rankPrereq, index);
  1071. packet->setArrayDataByName("tradeskillprestige_spell_id", (*itr3)->spellID, index);
  1072. packet->setArrayDataByName("tradeskillprestige_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  1073. packet->setArrayDataByName("tradeskillprestige_spell_name", (*itr3)->name.c_str(), index);
  1074. packet->setArrayDataByName("tradeskillprestige_spell_description", (*itr3)->description.c_str(), index);
  1075. packet->setArrayDataByName("tradeskillprestige_icon", (*itr3)->icon, index);
  1076. packet->setArrayDataByName("tradeskillprestige_icon2", (*itr3)->icon2, index);
  1077. packet->setArrayDataByName("tradeskillprestige_current_rank", current_rank, index); // TODO: need to get this value from the DB
  1078. packet->setArrayDataByName("tradeskillprestige_max_rank", (*itr3)->maxRank, index);
  1079. packet->setArrayDataByName("tradeskillprestige_rank_cost", (*itr3)->rankCost, index);
  1080. packet->setArrayDataByName("tradeskillprestige_min_lev", (*itr3)->min_level, index);
  1081. packet->setSubArrayLengthByName("tradeskillprestige_unknown5_num_items", 0, index, 0);
  1082. //packet->setSubArrayDataByName("tradeskillprestige_unknown5", 308397057, index, 0);
  1083. //packet->setSubArrayDataByName("tradeskillprestige_unknown5", 3215564363, index, 1);
  1084. //packet->setSubArrayDataByName("tradeskillprestige_unknown5", 445192837, index, 2);
  1085. //packet->setSubArrayDataByName("tradeskillprestige_unknown5", 3345493294, index, 3);
  1086. //packet->setSubArrayDataByName("tradeskillprestige_unknown5", 696953971, index, 4);
  1087. packet->setArrayDataByName("tradeskillprestige_unknown6", 4294967295, index);
  1088. packet->setArrayDataByName("tradeskillprestige_unknown7", 1, index);
  1089. packet->setArrayDataByName("tradeskillprestige_classification1", (*itr3)->class_name.c_str(), index);
  1090. packet->setArrayDataByName("tradeskillprestige_points_req", (*itr3)->req_points, index);
  1091. packet->setArrayDataByName("tradeskillprestige_unknown8", 0, index);
  1092. packet->setArrayDataByName("tradeskillprestige_classification2", (*itr3)->subclass_name.c_str(), index);
  1093. packet->setArrayDataByName("tradeskillprestige_col", (*itr3)->col, index);
  1094. packet->setArrayDataByName("tradeskillprestige_row", (*itr3)->row, index);
  1095. packet->setArrayDataByName("tradeskillprestige_line_title", (*itr3)->line_title.c_str(), index);
  1096. packet->setArrayDataByName("tradeskillprestige_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  1097. packet->setArrayDataByName("tradeskillprestige_points_to_unlock", (*itr3)->req_tree_points, index);
  1098. packet->setArrayDataByName("tradeskillprestige_unknown9b", 0, index);
  1099. //}
  1100. //else
  1101. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  1102. }
  1103. }
  1104. packet->setDataByName("tradeskillprestige_points_spent", 18);
  1105. if (version >= 58617) {
  1106. packet->setDataByName("tradeskillprestige_unknown10", 18);
  1107. packet->setDataByName("tradeskillprestige_unknown11a", 0);
  1108. packet->setDataByName("tradeskillprestige_unknown11b", 50386);
  1109. packet->setDataByName("tradeskillprestige_unknown11c", 3);
  1110. packet->setDataByName("tradeskillprestige_unknown12", 0, 0);
  1111. packet->setDataByName("tradeskillprestige_unknown12", 0, 1);
  1112. packet->setDataByName("tradeskillprestige_unknown12", 0, 2);
  1113. packet->setDataByName("tradeskillprestige_unknown14", 0);
  1114. packet->setDataByName("tradeskillprestige_unknown16", 4, 0);
  1115. packet->setDataByName("tradeskillprestige_unknown16", 0, 1);
  1116. packet->setDataByName("tradeskillprestige_unknown16", 0, 2);
  1117. packet->setDataByName("tradeskillprestige_unknown16", 0, 3);
  1118. packet->setDataByName("tradeskillprestige_unknown16", 0, 4);
  1119. packet->setDataByName("tradeskillprestige_unknown16", 0, 5);
  1120. }
  1121. else if (version >= 1193) {
  1122. packet->setDataByName("tradeskillprestige_unknown10", 16);
  1123. packet->setDataByName("tradeskillprestige_unknown11", 0, 0);
  1124. packet->setDataByName("tradeskillprestige_unknown11", 1, 1);
  1125. packet->setDataByName("tradeskillprestige_unknown11", 3, 2);
  1126. packet->setDataByName("tradeskillprestige_unknown12", 0, 0);
  1127. packet->setDataByName("tradeskillprestige_unknown12", 0, 1);
  1128. packet->setDataByName("tradeskillprestige_unknown12", 0, 2);
  1129. packet->setDataByName("tradeskillprestige_unknown16", 4, 0);
  1130. packet->setDataByName("tradeskillprestige_unknown16", 0, 1);
  1131. packet->setDataByName("tradeskillprestige_unknown16", 0, 2);
  1132. packet->setDataByName("tradeskillprestige_unknown16", 0, 3);
  1133. packet->setDataByName("tradeskillprestige_unknown16", 0, 4);
  1134. packet->setDataByName("tradeskillprestige_unknown16", 0, 5);
  1135. }
  1136. }
  1137. if (version >= 58617) {
  1138. //__________________________________________________________START OF DRAGON TREE____________________________________________________________________________________
  1139. for (itr2 = DragonTab.begin(); itr2 != DragonTab.end(); itr2++) {
  1140. dragon_num_items += (itr2->second).size();
  1141. }
  1142. LogWrite(SPELL__DEBUG, 0, "AA", "DragonTab Size...%i ", dragon_num_items);
  1143. index = 0;
  1144. packet->setDataByName("dragon_tab_title", "Dragon");
  1145. packet->setDataByName("dragon_tree_node_id", node_id[AA_DRAGON]);
  1146. packet->setDataByName("dragon_max_aa", rule_manager.GetGlobalRule(R_Player, MaxDragonAA)->GetInt32());
  1147. packet->setDataByName("dragon_id", classid[node_id[AA_DRAGON]]);
  1148. packet->setDataByName("dragon_eof_req", 0);
  1149. packet->setArrayLengthByName("dragon_num_items", dragon_num_items, 0);
  1150. for (itr2 = DragonTab.begin(); itr2 != DragonTab.end(); itr2++) {
  1151. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  1152. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  1153. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  1154. if (index == 0)
  1155. class_node_id = (*itr3)->spellID;
  1156. //if (spell) {
  1157. packet->setArrayDataByName("dragon_parent_id", (*itr3)->rankPrereqID, index);
  1158. packet->setArrayDataByName("dragon_req_tier", (*itr3)->rankPrereq, index);
  1159. packet->setArrayDataByName("dragon_spell_id", (*itr3)->spellID, index);
  1160. packet->setArrayDataByName("dragon_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  1161. packet->setArrayDataByName("dragon_spell_name", (*itr3)->name.c_str(), index);
  1162. packet->setArrayDataByName("dragon_spell_description", (*itr3)->description.c_str(), index);
  1163. packet->setArrayDataByName("dragon_icon", (*itr3)->icon, index);
  1164. packet->setArrayDataByName("dragon_icon2", (*itr3)->icon2, index);
  1165. packet->setArrayDataByName("dragon_current_rank", current_rank, index); // TODO: need to get this value from the DB
  1166. packet->setArrayDataByName("dragon_max_rank", (*itr3)->maxRank, index);
  1167. packet->setArrayDataByName("dragon_rank_cost", (*itr3)->rankCost, index);
  1168. packet->setArrayDataByName("dragon_min_lev", (*itr3)->min_level, index);
  1169. packet->setSubArrayLengthByName("dragon_unknown5_num_items", 0, index, 0);
  1170. //packet->setSubArrayDataByName("dragon_unknown5", 308397057, index, 0);
  1171. //packet->setSubArrayDataByName("dragon_unknown5", 3215564363, index, 1);
  1172. //packet->setSubArrayDataByName("dragon_unknown5", 445192837, index, 2);
  1173. //packet->setSubArrayDataByName("dragon_unknown5", 3345493294, index, 3);
  1174. //packet->setSubArrayDataByName("dragon_unknown5", 696953971, index, 4);
  1175. packet->setArrayDataByName("dragon_unknown6", 4294967295, index);
  1176. packet->setArrayDataByName("dragon_unknown7", 1, index);
  1177. packet->setArrayDataByName("dragon_classification1", (*itr3)->class_name.c_str(), index);
  1178. packet->setArrayDataByName("dragon_points_req", (*itr3)->req_points, index);
  1179. packet->setArrayDataByName("dragon_unknown8", 0, index);
  1180. packet->setArrayDataByName("dragon_classification2", (*itr3)->subclass_name.c_str(), index);
  1181. packet->setArrayDataByName("dragon_col", (*itr3)->col, index);
  1182. packet->setArrayDataByName("dragon_row", (*itr3)->row, index);
  1183. packet->setArrayDataByName("dragon_line_title", (*itr3)->line_title.c_str(), index);
  1184. packet->setArrayDataByName("dragon_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  1185. packet->setArrayDataByName("dragon_points_to_unlock", (*itr3)->req_tree_points, index);
  1186. packet->setArrayDataByName("dragon_unknown9b", 0, index);
  1187. //}
  1188. //else
  1189. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  1190. }
  1191. }
  1192. packet->setDataByName("dragon_points_spent", 19);
  1193. if (version >= 58617) {
  1194. packet->setDataByName("dragon_unknown10", 19);
  1195. packet->setDataByName("dragon_unknown11a", 0);
  1196. packet->setDataByName("dragon_unknown11b", 50386);
  1197. packet->setDataByName("dragon_unknown11c", 1);
  1198. packet->setDataByName("dragon_unknown12", 0, 0);
  1199. packet->setDataByName("dragon_unknown12", 0, 1);
  1200. packet->setDataByName("dragon_unknown12", 0, 2);
  1201. packet->setDataByName("dragon_unknown14", 0);
  1202. packet->setDataByName("dragon_unknown16", 0, 0);
  1203. packet->setDataByName("dragon_unknown16", 0, 1);
  1204. packet->setDataByName("dragon_unknown16", 0, 2);
  1205. packet->setDataByName("dragon_unknown16", 0, 3);
  1206. packet->setDataByName("dragon_unknown16", 0, 4);
  1207. packet->setDataByName("dragon_unknown16", 0, 5);
  1208. }
  1209. //__________________________________________________________START OF DRAGON CLASS TREE____________________________________________________________________________________
  1210. for (itr2 = DragonclassTab.begin(); itr2 != DragonclassTab.end(); itr2++) {
  1211. dragonclass_num_items += (itr2->second).size();
  1212. }
  1213. LogWrite(SPELL__DEBUG, 0, "AA", "DragonclassTab Size...%i ", dragonclass_num_items);
  1214. index = 0;
  1215. packet->setDataByName("dragonclass_tab_title", classes.GetClassNameCase(client->GetPlayer()->GetAdventureClass()).c_str());
  1216. packet->setDataByName("dragonclass_tree_node_id", node_id[AA_DRAGONCLASS]);
  1217. packet->setDataByName("dragonclass_max_aa", rule_manager.GetGlobalRule(R_Player, MaxDragonAA)->GetInt32());
  1218. packet->setDataByName("dragonclass_id", classid[node_id[AA_DRAGONCLASS]]);
  1219. packet->setDataByName("dragonclass_eof_req", 0);
  1220. packet->setArrayLengthByName("dragonclass_num_items", dragonclass_num_items, 0);
  1221. for (itr2 = DragonclassTab.begin(); itr2 != DragonclassTab.end(); itr2++) {
  1222. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  1223. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  1224. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  1225. if (index == 0)
  1226. class_node_id = (*itr3)->spellID;
  1227. //if (spell) {
  1228. packet->setArrayDataByName("dragonclass_parent_id", (*itr3)->rankPrereqID, index);
  1229. packet->setArrayDataByName("dragonclass_req_tier", (*itr3)->rankPrereq, index);
  1230. packet->setArrayDataByName("dragonclass_spell_id", (*itr3)->spellID, index);
  1231. packet->setArrayDataByName("dragonclass_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  1232. packet->setArrayDataByName("dragonclass_spell_name", (*itr3)->name.c_str(), index);
  1233. packet->setArrayDataByName("dragonclass_spell_description", (*itr3)->description.c_str(), index);
  1234. packet->setArrayDataByName("dragonclass_icon", (*itr3)->icon, index);
  1235. packet->setArrayDataByName("dragonclass_icon2", (*itr3)->icon2, index);
  1236. packet->setArrayDataByName("dragonclass_current_rank", current_rank, index); // TODO: need to get this value from the DB
  1237. packet->setArrayDataByName("dragonclass_max_rank", (*itr3)->maxRank, index);
  1238. packet->setArrayDataByName("dragonclass_rank_cost", (*itr3)->rankCost, index);
  1239. packet->setArrayDataByName("dragonclass_min_lev", (*itr3)->min_level, index);
  1240. packet->setSubArrayLengthByName("dragonclass_unknown5_num_items", 0, index, 0);
  1241. //packet->setSubArrayDataByName("dragonclass_unknown5", 308397057, index, 0);
  1242. //packet->setSubArrayDataByName("dragonclass_unknown5", 3215564363, index, 1);
  1243. //packet->setSubArrayDataByName("dragonclass_unknown5", 445192837, index, 2);
  1244. //packet->setSubArrayDataByName("dragonclass_unknown5", 3345493294, index, 3);
  1245. //packet->setSubArrayDataByName("dragonclass_unknown5", 696953971, index, 4);
  1246. packet->setArrayDataByName("dragonclass_unknown6", 4294967295, index);
  1247. packet->setArrayDataByName("dragonclass_unknown7", 1, index);
  1248. packet->setArrayDataByName("dragonclass_classification1", (*itr3)->class_name.c_str(), index);
  1249. packet->setArrayDataByName("dragonclass_points_req", (*itr3)->req_points, index);
  1250. packet->setArrayDataByName("dragonclass_unknown8", 0, index);
  1251. packet->setArrayDataByName("dragonclass_classification2", (*itr3)->subclass_name.c_str(), index);
  1252. packet->setArrayDataByName("dragonclass_col", (*itr3)->col, index);
  1253. packet->setArrayDataByName("dragonclass_row", (*itr3)->row, index);
  1254. packet->setArrayDataByName("dragonclass_line_title", (*itr3)->line_title.c_str(), index);
  1255. packet->setArrayDataByName("dragonclass_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  1256. packet->setArrayDataByName("dragonclass_points_to_unlock", (*itr3)->req_tree_points, index);
  1257. packet->setArrayDataByName("dragonclass_unknown9b", 0, index);
  1258. //}
  1259. //else
  1260. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  1261. }
  1262. }
  1263. packet->setDataByName("dragonclass_points_spent",20);
  1264. if (version >= 58617) {
  1265. packet->setDataByName("dragonclass_unknown10", 20);
  1266. packet->setDataByName("dragonclass_unknown11a", 0);
  1267. packet->setDataByName("dragonclass_unknown11b", 50386);
  1268. packet->setDataByName("dragonclass_unknown11c", 3);
  1269. packet->setDataByName("dragonclass_unknown12", 0, 0);
  1270. packet->setDataByName("dragonclass_unknown12", 0, 1);
  1271. packet->setDataByName("dragonclass_unknown12", 0, 2);
  1272. packet->setDataByName("dragonclass_unknown14", 0);
  1273. packet->setDataByName("dragonclass_unknown16", 2, 0);
  1274. packet->setDataByName("dragonclass_unknown16", 0, 1);
  1275. packet->setDataByName("dragonclass_unknown16", 0, 2);
  1276. packet->setDataByName("dragonclass_unknown16", 0, 3);
  1277. packet->setDataByName("dragonclass_unknown16", 0, 4);
  1278. packet->setDataByName("dragonclass_unknown16", 0, 5);
  1279. }
  1280. //__________________________________________________________START OF FARSEAS TREE____________________________________________________________________________________
  1281. for (itr2 = FarseasTab.begin(); itr2 != FarseasTab.end(); itr2++) {
  1282. farseas_num_items += (itr2->second).size();
  1283. }
  1284. LogWrite(SPELL__DEBUG, 0, "AA", "FarseasTab Size...%i ", farseas_num_items);
  1285. index = 0;
  1286. packet->setDataByName("farseas_tab_title", "Farseas");
  1287. packet->setDataByName("farseas_tree_node_id", node_id[AA_FARSEAS]);
  1288. packet->setDataByName("farseas_max_aa", rule_manager.GetGlobalRule(R_Player, MaxDragonAA)->GetInt32());
  1289. packet->setDataByName("farseas_id", classid[node_id[AA_FARSEAS]]);
  1290. packet->setDataByName("farseas_eof_req", 0);
  1291. packet->setArrayLengthByName("farseas_num_items", farseas_num_items, 0);
  1292. for (itr2 = FarseasTab.begin(); itr2 != FarseasTab.end(); itr2++) {
  1293. for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
  1294. //spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
  1295. //current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
  1296. if (index == 0)
  1297. class_node_id = (*itr3)->spellID;
  1298. //if (spell) {
  1299. packet->setArrayDataByName("farseas_parent_id", (*itr3)->rankPrereqID, index);
  1300. packet->setArrayDataByName("farseas_req_tier", (*itr3)->rankPrereq, index);
  1301. packet->setArrayDataByName("farseas_spell_id", (*itr3)->spellID, index);
  1302. packet->setArrayDataByName("farseas_active", (current_rank == 0 ? 0 : (current_rank >= (*itr3)->maxRank) ? 2 : 1), index);
  1303. packet->setArrayDataByName("farseas_spell_name", (*itr3)->name.c_str(), index);
  1304. packet->setArrayDataByName("farseas_spell_description", (*itr3)->description.c_str(), index);
  1305. packet->setArrayDataByName("farseas_icon", (*itr3)->icon, index);
  1306. packet->setArrayDataByName("farseas_icon2", (*itr3)->icon2, index);
  1307. packet->setArrayDataByName("farseas_current_rank", current_rank, index); // TODO: need to get this value from the DB
  1308. packet->setArrayDataByName("farseas_max_rank", (*itr3)->maxRank, index);
  1309. packet->setArrayDataByName("farseas_rank_cost", (*itr3)->rankCost, index);
  1310. packet->setArrayDataByName("farseas_min_lev", (*itr3)->min_level, index);
  1311. packet->setSubArrayLengthByName("farseas_unknown5_num_items", 0, index, 0);
  1312. //packet->setSubArrayDataByName("farseas_unknown5", 308397057, index, 0);
  1313. //packet->setSubArrayDataByName("farseas_unknown5", 3215564363, index, 1);
  1314. //packet->setSubArrayDataByName("farseas_unknown5", 445192837, index, 2);
  1315. //packet->setSubArrayDataByName("farseas_unknown5", 3345493294, index, 3);
  1316. //packet->setSubArrayDataByName("farseas_unknown5", 696953971, index, 4);
  1317. packet->setArrayDataByName("farseas_unknown6", 4294967295, index);
  1318. packet->setArrayDataByName("farseas_unknown7", 1, index);
  1319. packet->setArrayDataByName("farseas_classification1", (*itr3)->class_name.c_str(), index);
  1320. packet->setArrayDataByName("farseas_points_req", (*itr3)->req_points, index);
  1321. packet->setArrayDataByName("farseas_unknown8", 0, index);
  1322. packet->setArrayDataByName("farseas_classification2", (*itr3)->subclass_name.c_str(), index);
  1323. packet->setArrayDataByName("farseas_col", (*itr3)->col, index);
  1324. packet->setArrayDataByName("farseas_row", (*itr3)->row, index);
  1325. packet->setArrayDataByName("farseas_line_title", (*itr3)->line_title.c_str(), index);
  1326. packet->setArrayDataByName("farseas_unknown9", ((*itr3)->title_level > 0 ? 258 : 0), index);
  1327. packet->setArrayDataByName("farseas_points_to_unlock", (*itr3)->req_tree_points, index);
  1328. packet->setArrayDataByName("farseas_unknown9b", 0, index);
  1329. //}
  1330. //else
  1331. //LogWrite(SPELL__ERROR, 0, "AltAdvancement","Could not find Spell ID %u and Tier %i in Master Spell List", (*itr3)->spellID, (*itr3)->tier);
  1332. }
  1333. }
  1334. packet->setDataByName("farseas_points_spent",20);
  1335. if (version >= 58617) {
  1336. packet->setDataByName("farseas_unknown10", 20);
  1337. packet->setDataByName("farseas_unknown11a", 0);
  1338. packet->setDataByName("farseas_unknown11b", 50386);
  1339. packet->setDataByName("farseas_unknown11c", 3);
  1340. packet->setDataByName("farseas_unknown12", 0, 0);
  1341. packet->setDataByName("farseas_unknown12", 0, 1);
  1342. packet->setDataByName("farseas_unknown12", 0, 2);
  1343. packet->setDataByName("farseas_unknown14", 0);
  1344. packet->setDataByName("farseas_unknown16", 4, 0);
  1345. packet->setDataByName("farseas_unknown16", 0, 1);
  1346. packet->setDataByName("farseas_unknown16", 0, 2);
  1347. packet->setDataByName("farseas_unknown16", 0, 3);
  1348. packet->setDataByName("farseas_unknown16", 0, 4);
  1349. packet->setDataByName("farseas_unknown16", 0, 5);
  1350. }
  1351. int8 tt = 0;
  1352. int8 numtabs = 0;
  1353. int xxx = 0;
  1354. bool sendblanktabs = false;
  1355. packet->setDataByName("template_unknown1", (changemode == 2 ? 255 : 25));
  1356. packet->setDataByName("template_unknown2a", 0);
  1357. packet->setDataByName("template_unknown2b", 0);
  1358. packet->setDataByName("template_unknown2c", (changemode == 3 ? 1 : 0));
  1359. packet->setDataByName("template_unknown2d", (changemode == 1 || changemode == 2 ? 1 :0));
  1360. packet->setDataByName("template_unknown3", (changemode == 2 ? 0 : 4294967295)); //4294967295);
  1361. packet->setDataByName("template_unknown4", newtemplate);// active template ID
  1362. packet->setDataByName("template_unknown5", 0);
  1363. packet->setDataByName("num_templates", 7);
  1364. packet->setDataByName("slot1_template_id", 0);
  1365. packet->setDataByName("slot1_name", "Unused Slot 1");
  1366. packet->setDataByName("slot1_active", 0); //0 is server type ,1 = personal type
  1367. tt = 1; // template #
  1368. numtabs = 0;
  1369. if (AAEntryList[tt][0].size() > 0) { numtabs++; }
  1370. if (AAEntryList[tt][1].size() > 0) { numtabs++; }
  1371. if (AAEntryList[tt][2].size() > 0) { numtabs++; }
  1372. if (AAEntryList[tt][3].size() > 0) { numtabs++; }
  1373. if (AAEntryList[tt][4].size() > 0) { numtabs++; }
  1374. if (sendblanktabs == true) {
  1375. numtabs = 4;
  1376. }
  1377. packet->setArrayLengthByName("slot1_num_tabs", numtabs);
  1378. xxx = 0;
  1379. for (int xx = 0; xx < AAEntryList[tt].size(); xx++) {
  1380. if (sendblanktabs == false && AAEntryList[tt][xx].size() < 1 ) {continue;}
  1381. packet->setArrayDataByName("slot1_tab_typenum", xx, xxx);
  1382. packet->setArrayDataByName("slot1_tab_unknown2", 1, xxx);
  1383. packet->setSubArrayLengthByName("slot1_num_items", AAEntryList[tt][xx].size(), xxx);
  1384. for (int yy = 0; yy < AAEntryList[tt][xx].size(); yy++) {
  1385. packet->setSubArrayDataByName("slot1_item_order", AAEntryList[tt][xx][yy].order, xxx, yy);
  1386. packet->setSubArrayDataByName("slot1_item_treeid", AAEntryList[tt][xx][yy].treeid, xxx, yy);
  1387. packet->setSubArrayDataByName("slot1_item_id", AAEntryList[tt][xx][yy].aa_id, xxx, yy);
  1388. }
  1389. xxx++;
  1390. }
  1391. packet->setDataByName("slot2_template_id", 1);
  1392. packet->setDataByName("slot2_name", "Unused Slot 2");
  1393. packet->setDataByName("slot2_active", 0);
  1394. tt = 2; // template #
  1395. numtabs = 0;
  1396. if (AAEntryList[tt][0].size() > 0) { numtabs++; }
  1397. if (AAEntryList[tt][1].size() > 0) { numtabs++; }
  1398. if (AAEntryList[tt][2].size() > 0) { numtabs++; }
  1399. if (AAEntryList[tt][3].size() > 0) { numtabs++; }
  1400. if (AAEntryList[tt][4].size() > 0) { numtabs++; }
  1401. if (sendblanktabs == true) {
  1402. numtabs = 4;
  1403. }
  1404. packet->setArrayLengthByName("slot2_num_tabs", numtabs);
  1405. xxx = 0;
  1406. for (int xx = 0; xx < AAEntryList[tt].size(); xx++) {
  1407. if (sendblanktabs == false && AAEntryList[tt][xx].size() < 1) { continue; }
  1408. packet->setArrayDataByName("slot2_tab_typenum", xx, xxx);
  1409. packet->setArrayDataByName("slot2_tab_unknown2", 1, xxx);
  1410. packet->setSubArrayLengthByName("slot2_num_items", AAEntryList[tt][xx].size(), xxx);
  1411. for (int yy = 0; yy < AAEntryList[tt][xx].size(); yy++) {
  1412. packet->setSubArrayDataByName("slot2_item_order", AAEntryList[tt][xx][yy].order, xxx, yy);
  1413. packet->setSubArrayDataByName("slot2_item_treeid", AAEntryList[tt][xx][yy].treeid, xxx, yy);
  1414. packet->setSubArrayDataByName("slot2_item_id", AAEntryList[tt][xx][yy].aa_id, xxx, yy);
  1415. }
  1416. xxx++;
  1417. }
  1418. packet->setDataByName("slot3_template_id", 2);
  1419. packet->setDataByName("slot3_name", "Unused Slot 3");
  1420. packet->setDataByName("slot3_active", 0);
  1421. tt = 3; // template #
  1422. numtabs = 0;
  1423. if (AAEntryList[tt][0].size() > 0) { numtabs++; }
  1424. if (AAEntryList[tt][1].size() > 0) { numtabs++; }
  1425. if (AAEntryList[tt][2].size() > 0) { numtabs++; }
  1426. if (AAEntryList[tt][3].size() > 0) { numtabs++; }
  1427. if (AAEntryList[tt][4].size() > 0) { numtabs++; }
  1428. if (sendblanktabs == true) {
  1429. numtabs = 4;
  1430. }
  1431. packet->setArrayLengthByName("slot3_num_tabs", numtabs);
  1432. xxx = 0;
  1433. for (int xx = 0; xx < AAEntryList[tt].size(); xx++) {
  1434. if (sendblanktabs == false && AAEntryList[tt][xx].size() < 1) { continue; }
  1435. packet->setArrayDataByName("slot3_tab_typenum", xx, xxx);
  1436. packet->setArrayDataByName("slot3_tab_unknown2", 1, xxx);
  1437. packet->setSubArrayLengthByName("slot3_num_items", AAEntryList[tt][xx].size(), xxx);
  1438. for (int yy = 0; yy < AAEntryList[tt][xx].size(); yy++) {
  1439. packet->setSubArrayDataByName("slot3_item_order", AAEntryList[tt][xx][yy].order, xxx, yy);
  1440. packet->setSubArrayDataByName("slot3_item_treeid", AAEntryList[tt][xx][yy].treeid, xxx, yy);
  1441. packet->setSubArrayDataByName("slot3_item_id", AAEntryList[tt][xx][yy].aa_id, xxx, yy);
  1442. }
  1443. xxx++;
  1444. }
  1445. packet->setDataByName("slot4_template_id", 20);
  1446. packet->setDataByName("slot4_name", "Basic Leveling Profile - Solo");
  1447. packet->setDataByName("slot4_active", 1);
  1448. tt = 4; // template #
  1449. numtabs = 0;
  1450. if (AAEntryList[tt][0].size() > 0) { numtabs++; }
  1451. if (AAEntryList[tt][1].size() > 0) { numtabs++; }
  1452. if (AAEntryList[tt][2].size() > 0) { numtabs++; }
  1453. if (AAEntryList[tt][3].size() > 0) { numtabs++; }
  1454. if (AAEntryList[tt][4].size() > 0) { numtabs++; }
  1455. if (sendblanktabs == true) {
  1456. numtabs = 4;
  1457. }
  1458. packet->setArrayLengthByName("slot4_num_tabs", numtabs);
  1459. xxx = 0;
  1460. for (int xx = 0; xx < AAEntryList[tt].size(); xx++) {
  1461. if (sendblanktabs == false && AAEntryList[tt][xx].size() < 1) { continue; }
  1462. packet->setArrayDataByName("slot4_tab_typenum", xx, xxx);
  1463. packet->setArrayDataByName("slot4_tab_unknown2", 1, xxx);
  1464. packet->setSubArrayLengthByName("slot4_num_items", AAEntryList[tt][xx].size(), xxx);
  1465. for (int yy = 0; yy < AAEntryList[tt][xx].size(); yy++) {
  1466. packet->setSubArrayDataByName("slot4_item_order", AAEntryList[tt][xx][yy].order, xxx, yy);
  1467. packet->setSubArrayDataByName("slot4_item_treeid", AAEntryList[tt][xx][yy].treeid, xxx, yy);
  1468. packet->setSubArrayDataByName("slot4_item_id", AAEntryList[tt][xx][yy].aa_id, xxx, yy);
  1469. }
  1470. xxx++;
  1471. }
  1472. packet->setDataByName("slot5_template_id", 21);
  1473. packet->setDataByName("slot5_name", "Basic Leveling Profile - Group");
  1474. packet->setDataByName("slot5_active", 1);
  1475. tt = 5; // template #
  1476. numtabs = 0;
  1477. if (AAEntryList[tt][0].size() > 0) { numtabs++; }
  1478. if (AAEntryList[tt][1].size() > 0) { numtabs++; }
  1479. if (AAEntryList[tt][2].size() > 0) { numtabs++; }
  1480. if (AAEntryList[tt][3].size() > 0) { numtabs++; }
  1481. if (AAEntryList[tt][4].size() > 0) { numtabs++; }
  1482. if (sendblanktabs == true) {
  1483. numtabs = 4;
  1484. }
  1485. packet->setArrayLengthByName("slot5_num_tabs", numtabs);
  1486. xxx = 0;
  1487. for (int xx = 0; xx < AAEntryList[tt].size(); xx++) {
  1488. if (sendblanktabs == false && AAEntryList[tt][xx].size() < 1) { continue; }
  1489. packet->setArrayDataByName("slot5_tab_typenum", xx, xxx);
  1490. packet->setArrayDataByName("slot5_tab_unknown2", 1, xxx);
  1491. packet->setSubArrayLengthByName("slot5_num_items", AAEntryList[tt][xx].size(), xxx);
  1492. for (int yy = 0; yy < AAEntryList[tt][xx].size(); yy++) {
  1493. packet->setSubArrayDataByName("slot5_item_order", AAEntryList[tt][xx][yy].order, xxx, yy);
  1494. packet->setSubArrayDataByName("slot5_item_treeid", AAEntryList[tt][xx][yy].treeid, xxx, yy);
  1495. packet->setSubArrayDataByName("slot5_item_id", AAEntryList[tt][xx][yy].aa_id, xxx, yy);
  1496. }
  1497. xxx++;
  1498. }
  1499. packet->setDataByName("slot6_template_id", 22);
  1500. packet->setDataByName("slot6_name", "Basic Leveling Profile - PVP");
  1501. packet->setDataByName("slot6_active", 1);
  1502. tt = 6; // template #
  1503. numtabs = 0;
  1504. if (AAEntryList[tt][0].size() > 0) { numtabs++; }
  1505. if (AAEntryList[tt][1].size() > 0) { numtabs++; }
  1506. if (AAEntryList[tt][2].size() > 0) { numtabs++; }
  1507. if (AAEntryList[tt][3].size() > 0) { numtabs++; }
  1508. if (AAEntryList[tt][4].size() > 0) { numtabs++; }
  1509. if (sendblanktabs == true) {
  1510. numtabs = 4;
  1511. }
  1512. packet->setArrayLengthByName("slot6_num_tabs", numtabs);
  1513. xxx = 0;
  1514. for (int xx = 0; xx < AAEntryList[tt].size(); xx++) {
  1515. if (sendblanktabs == false && AAEntryList[tt][xx].size() < 1) { continue; }
  1516. packet->setArrayDataByName("slot6_tab_typenum", xx, xxx);
  1517. packet->setArrayDataByName("slot6_tab_unknown2", 1, xxx);
  1518. packet->setSubArrayLengthByName("slot6_num_items", AAEntryList[tt][xx].size(), xxx);
  1519. for (int yy = 0; yy < AAEntryList[tt][xx].size(); yy++) {
  1520. packet->setSubArrayDataByName("slot6_item_order", AAEntryList[tt][xx][yy].order, xxx, yy);
  1521. packet->setSubArrayDataByName("slot6_item_treeid", AAEntryList[tt][xx][yy].treeid, xxx, yy);
  1522. packet->setSubArrayDataByName("slot6_item_id", AAEntryList[tt][xx][yy].aa_id, xxx, yy);
  1523. }
  1524. xxx++;
  1525. }
  1526. packet->setDataByName("slot7_template_id",100);
  1527. packet->setDataByName("slot7_name", "New");
  1528. packet->setDataByName("slot7_active", 0);
  1529. tt = 7; // template #
  1530. numtabs = 0;
  1531. if (AAEntryList[tt][0].size() > 0) { numtabs++; }
  1532. if (AAEntryList[tt][1].size() > 0) { numtabs++; }
  1533. if (AAEntryList[tt][2].size() > 0) { numtabs++; }
  1534. if (AAEntryList[tt][3].size() > 0) { numtabs++; }
  1535. if (AAEntryList[tt][4].size() > 0) { numtabs++; }
  1536. if (sendblanktabs == true) {
  1537. numtabs = 4;
  1538. }
  1539. packet->setArrayLengthByName("slot7_num_tabs", numtabs);
  1540. xxx = 0;
  1541. for (int xx = 0; xx < AAEntryList[tt].size(); xx++) {
  1542. if (sendblanktabs == false && AAEntryList[tt][xx].size() < 1) { continue; }
  1543. packet->setArrayDataByName("slot7_tab_typenum", xx, xxx);
  1544. packet->setArrayDataByName("slot7_tab_unknown2", 1, xxx);
  1545. packet->setSubArrayLengthByName("slot7_num_items", AAEntryList[tt][xx].size(), xxx);
  1546. for (int yy = 0; yy < AAEntryList[tt][xx].size(); yy++) {
  1547. packet->setSubArrayDataByName("slot7_item_order", AAEntryList[tt][xx][yy].order, xxx, yy);
  1548. packet->setSubArrayDataByName("slot7_item_treeid", AAEntryList[tt][xx][yy].treeid, xxx, yy);
  1549. packet->setSubArrayDataByName("slot7_item_id", AAEntryList[tt][xx][yy].aa_id, xxx, yy);
  1550. }
  1551. xxx++;
  1552. }
  1553. //packet->PrintPacket();
  1554. }
  1555. //packet->PrintPacket();
  1556. EQ2Packet* data = packet->serialize();
  1557. EQ2Packet* app = new EQ2Packet(OP_AdventureList, data->pBuffer, data->size);
  1558. //DumpPacket(app);
  1559. client->QueuePacket(app);
  1560. safe_delete(packet);
  1561. safe_delete(data);
  1562. }