9
3

AltAdvancement.cpp 83 KB

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