Clone of Akilla's acserver @ https://github.com/deregtd/ACServer

GameParsing.cpp 70KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074
  1. #include "stdafx.h"
  2. #include "GameParsing.h"
  3. stSkillInfo SkillInfo[] = {
  4. { _T( "Unknown" ), STAT_NULL, STAT_NULL, 1, eTrainUnusable },
  5. { _T( "Axe" ), STAT_STRENGTH, STAT_COORDINATION, 3, eTrainUnusable },
  6. { _T( "Bow" ), STAT_COORDINATION, STAT_NULL, 2, eTrainUnusable },
  7. { _T( "Crossbow" ), STAT_COORDINATION, STAT_NULL, 2, eTrainUnusable },
  8. { _T( "Dagger" ), STAT_QUICKNESS, STAT_COORDINATION, 3, eTrainUnusable },
  9. { _T( "Mace" ), STAT_STRENGTH, STAT_COORDINATION, 3, eTrainUnusable },
  10. { _T( "Melee Defense" ), STAT_QUICKNESS, STAT_COORDINATION, 3, eTrainUnusable },
  11. { _T( "Missile Defense" ), STAT_QUICKNESS, STAT_COORDINATION, 5, eTrainUnusable },
  12. { _T( "Unknown" ), STAT_NULL, STAT_NULL, 1, eTrainUnusable },
  13. { _T( "Spear" ), STAT_STRENGTH, STAT_COORDINATION, 3, eTrainUnusable },
  14. { _T( "Staff" ), STAT_STRENGTH, STAT_COORDINATION, 3, eTrainUnusable },
  15. { _T( "Sword" ), STAT_STRENGTH, STAT_COORDINATION, 3, eTrainUnusable },
  16. { _T( "Thrown Weapons" ), STAT_STRENGTH, STAT_COORDINATION, 3, eTrainUnusable },
  17. { _T( "Unarmed Combat" ), STAT_STRENGTH, STAT_COORDINATION, 3, eTrainUnusable },
  18. { _T( "Arcane Lore" ), STAT_FOCUS, STAT_NULL, 3, eTrainUnusable },
  19. { _T( "Magic Defense" ), STAT_FOCUS, STAT_SELF, 7, eTrainUnusable },
  20. { _T( "Mana Conversion" ), STAT_FOCUS, STAT_SELF, 6, eTrainUnusable },
  21. { _T( "Unknown" ), STAT_NULL, STAT_NULL, 1, eTrainUnusable },
  22. { _T( "Appraise Item" ), STAT_FOCUS, STAT_NULL, 1, eTrainUnusable },
  23. { _T( "Assess Person" ), STAT_FOCUS, STAT_SELF, 2, eTrainUnusable },
  24. { _T( "Deception" ), STAT_FOCUS, STAT_SELF, 4, eTrainUnusable },
  25. { _T( "Healing" ), STAT_FOCUS, STAT_COORDINATION, 3, eTrainUnusable },
  26. { _T( "Jump" ), STAT_STRENGTH, STAT_COORDINATION, 2, eTrainUnusable },
  27. { _T( "Lockpick" ), STAT_FOCUS, STAT_COORDINATION, 3, eTrainUnusable },
  28. { _T( "Run" ), STAT_QUICKNESS, STAT_NULL, 1, eTrainUnusable },
  29. { _T( "Unknown" ), STAT_NULL, STAT_NULL, 1, eTrainUnusable },
  30. { _T( "Unknown" ), STAT_NULL, STAT_NULL, 1, eTrainUnusable },
  31. { _T( "Assess Creature" ), STAT_FOCUS, STAT_SELF, 2, eTrainUnusable },
  32. { _T( "Appraise Weapon" ), STAT_FOCUS, STAT_NULL, 1, eTrainUnusable },
  33. { _T( "Appraise Armor" ), STAT_FOCUS, STAT_NULL, 1, eTrainUnusable },
  34. { _T( "Appraise Magic Item" ), STAT_FOCUS, STAT_NULL, 1, eTrainUnusable },
  35. { _T( "Creature Enchantment" ), STAT_FOCUS, STAT_SELF, 4, eTrainUnusable },
  36. { _T( "Item Enchantment" ), STAT_FOCUS, STAT_SELF, 4, eTrainUnusable },
  37. { _T( "Life Magic" ), STAT_FOCUS, STAT_SELF, 4, eTrainUnusable },
  38. { _T( "War Magic" ), STAT_FOCUS, STAT_SELF, 4, eTrainUnusable },
  39. { _T( "Leadership" ), STAT_SELF, STAT_NULL, 4, eTrainUnusable },
  40. { _T( "Loyalty" ), STAT_SELF, STAT_NULL, 4, eTrainUnusable },
  41. { _T( "Fletching" ), STAT_FOCUS, STAT_COORDINATION, 3, eTrainUnusable },
  42. { _T( "Alchemy" ), STAT_FOCUS, STAT_COORDINATION, 3, eTrainUnusable },
  43. { _T( "Cooking" ), STAT_FOCUS, STAT_COORDINATION, 3, eTrainUnusable }
  44. };
  45. const char *StatName[6] = { "Strength", "Endurance", "Coordination", "Quickness", "Focus", "Self" };
  46. const char *SecondaryStatName[6] = { "Health", "Stamina", "Mana" };
  47. void cACServer::Parse200(int UserParsing, DWORD MessageType, BYTE *Packet, int PacketLen)
  48. {
  49. switch (MessageType)
  50. {
  51. case 0xF656:
  52. {
  53. //Character Creation!!
  54. DWORD beefbeef, tpdword;
  55. BYTE shit[0x170], *PackPointer;
  56. PackPointer = Packet;
  57. memcpy(&beefbeef, PackPointer, 4); PackPointer += 4;
  58. memcpy(shit, PackPointer, 0x168); PackPointer += 0x168; //starts at $20
  59. WORD CharNameLen;
  60. BYTE CharName[32];
  61. memcpy(&CharNameLen, PackPointer, 2); PackPointer += 2;
  62. memcpy(CharName, PackPointer, CharNameLen); PackPointer += CharNameLen;
  63. DWORD CharNum;
  64. for (int i=0;i<5;i++)
  65. {
  66. if (!ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[i])
  67. {
  68. memcpy(ZonePasses[ConnUser[UserParsing].ZoneNum].Names[i], CharName,32);
  69. CalcNextFreeGUID();
  70. ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[i] = NextFreeCharGUID;
  71. CharNum = i;
  72. i = 5;
  73. SaveAccounts();
  74. }
  75. }
  76. //Fill out stCharType and send to WorldServer
  77. cWorldObject_Char * NewChar = new cWorldObject_Char();
  78. NewChar->GUID = ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[CharNum];
  79. memcpy(NewChar->Name, CharName, 32);
  80. sprintf(NewChar->Title, "Newb");
  81. //Read in shit
  82. PackPointer = &shit[0];
  83. // char ZN[20]; memcpy(ZN, PackPointer, 20); PackPointer += 20; //Unknown1
  84. // DWORD unk1; memcpy(&unk1, PackPointer, 4); PackPointer += 4; //Unknown1
  85. // memcpy(&NewChar->Gender , PackPointer, 4); PackPointer += 4; //Guessing its Gender
  86. // memcpy(&NewChar->Race , PackPointer, 4); PackPointer += 4; //Race, Aluv/Gharu/Sho 0/1/2
  87. /*$70 unknown right now*/ PackPointer += 0xA4;
  88. memcpy(&NewChar->InitialStat[0], PackPointer, 6*4); PackPointer += 6*4;
  89. /*$10 unknown right now*/ PackPointer += 0x10;
  90. sprintf(sayit, "* %s created a new char, %s with GUID: %08X", ConnUser[UserParsing].ZoneName, NewChar->Name , NewChar->GUID); LogDisp(sayit);
  91. ZeroMemory(NewChar->SkillInc, sizeof(NewChar->SkillInc));
  92. ZeroMemory(NewChar->SkillFreeXP, sizeof(NewChar->SkillFreeXP));
  93. ZeroMemory(NewChar->SkillXP, sizeof(NewChar->SkillXP));
  94. DWORD tpskill;
  95. for (i=0; i < 39; i++)
  96. {
  97. memcpy(&tpskill, PackPointer, 4);
  98. PackPointer += 4;
  99. NewChar->SkillTrain[i+1] = 0;
  100. if (tpskill)
  101. {
  102. NewChar->SkillTrain[i+1] = tpskill;
  103. if (tpskill == 1)
  104. {
  105. NewChar->SkillInc[i+1] = 0;
  106. NewChar->SkillFreeXP[i+1] = 0;
  107. }
  108. if (tpskill == 2)
  109. {
  110. NewChar->SkillInc[i+1] = 5;
  111. NewChar->SkillFreeXP[i+1] = 526;
  112. }
  113. if (tpskill == 3)
  114. {
  115. NewChar->SkillInc[i+1] = 10;
  116. NewChar->SkillFreeXP[i+1] = 671;
  117. }
  118. NewChar->SkillXP[i+1] = 0;
  119. }
  120. }
  121. NewChar->Vitae = 0;
  122. NewChar->Level = 1;
  123. //Eventually decode starting place... For now teth works. :)
  124. NewChar->Loc.landblock = 0x25810034;
  125. NewChar->Loc.x = 156.1f;
  126. NewChar->Loc.y = 81.9f;
  127. NewChar->Loc.z = 220.0f;
  128. tpdword = 0x3F579630; memcpy(&NewChar->Loc.a, &tpdword, 4);
  129. NewChar->Loc.b = 0x00000000;
  130. NewChar->Loc.c = 0x00000000;
  131. NewChar->Loc.w = 90.1f; //Heading
  132. memcpy(&NewChar->LSTie, &NewChar->Loc, sizeof(NewChar->Loc));
  133. NewChar->CurrentSecondaryStat[0] = NewChar->InitialStat[1]/2;
  134. NewChar->CurrentSecondaryStat[1] = NewChar->InitialStat[1];
  135. NewChar->CurrentSecondaryStat[2] = NewChar->InitialStat[5];
  136. NewChar->BaseSecondaryStat[0] = NewChar->InitialStat[1]/2;
  137. NewChar->BaseSecondaryStat[1] = NewChar->InitialStat[1];
  138. NewChar->BaseSecondaryStat[2] = NewChar->InitialStat[5];
  139. ZeroMemory(NewChar->XPIntoSecondaryStat, sizeof(NewChar->XPIntoSecondaryStat));
  140. ZeroMemory(NewChar->XPIntoStat, sizeof(NewChar->XPIntoStat));
  141. ZeroMemory(NewChar->SecondaryStatInc, sizeof(NewChar->SecondaryStatInc));
  142. memcpy(NewChar->CurrentStat, NewChar->InitialStat, 6*4);
  143. ZeroMemory(NewChar->MainPack, sizeof(NewChar->MainPack));
  144. ZeroMemory(NewChar->SidePacks, sizeof(NewChar->SidePacks));
  145. ZeroMemory(NewChar->Equipped, sizeof(NewChar->Equipped));
  146. NewChar->Model = 1;
  147. NewChar->Monarch = 0;
  148. NewChar->NumLogins = 1;
  149. NewChar->Options = 0x01E8E543;
  150. NewChar->Patron = 0;
  151. NewChar->SkillCredits = 0;
  152. ZeroMemory(NewChar->SpellsLearned, sizeof(NewChar->SpellsLearned));
  153. NewChar->TotalXP = 0;
  154. NewChar->UnassignedXP = 0;
  155. NewChar->Vitae = 0;
  156. NewChar->Class = 0;
  157. ZeroMemory(NewChar->Vassal, sizeof(NewChar->Vassal));
  158. ZeroMemory(NewChar->ShortCut, sizeof(NewChar->ShortCut));
  159. ZeroMemory(NewChar->SpellsLearned, sizeof(NewChar->SpellsLearned));
  160. ZeroMemory(NewChar->SpellBar, sizeof(NewChar->SpellBar));
  161. NewChar->Scale = 1.0f;
  162. FILE *out = fopen("CharList.dat","a+b");
  163. fseek(out, 0, SEEK_END);
  164. BYTE TPlog[0x2000]; int charsize = NewChar->Serialize(TPlog);
  165. fwrite(&NewChar->GUID, 4, 1, out);
  166. fwrite(NewChar->Name, 32, 1, out);
  167. fwrite(&NewChar->Loc, sizeof(Location_t), 1, out);
  168. fwrite(TPlog, charsize, 1, out);
  169. fclose(out);
  170. sprintf(sayit, "New char created: %s with GUID %08X", NewChar->Name, NewChar->GUID); LogDisp(sayit);
  171. //Create Char Respond Packet...
  172. BYTE CreateChar[0x100];
  173. PackPointer = &CreateChar[0];
  174. tpdword = 0x0000F643; memcpy(PackPointer, &tpdword, 4); PackPointer += 4;
  175. tpdword = 0x00000001; memcpy(PackPointer, &tpdword, 4); PackPointer += 4; //Success
  176. tpdword = ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[CharNum]; memcpy(PackPointer, &tpdword, 4); PackPointer += 4;
  177. int outlen; GenString(ZonePasses[ConnUser[UserParsing].ZoneNum].Names[CharNum], &outlen, PackPointer); PackPointer += outlen;
  178. tpdword = 0x00000000; memcpy(PackPointer, &tpdword, 4); PackPointer += 4;
  179. DWORD PackLen = (DWORD) ((DWORD) PackPointer - (DWORD) CreateChar);
  180. Send200(CreateChar, PackLen, 4, UserParsing);
  181. //Resend Char List!
  182. SendCharList(UserParsing);
  183. }
  184. break;
  185. case 0xF7C8:
  186. {
  187. //Entering Game
  188. UpdateCharInfo(UserParsing, "Got Enter Game Packet...");
  189. //Now to return a fun 200 packet... whee...
  190. DWORD tph3 = 0x0000F7C7;
  191. Send200((BYTE *) &tph3, sizeof(tph3), 4, UserParsing);
  192. ConnUser[UserParsing].State = 2;
  193. }
  194. break;
  195. case 0xF7D9:
  196. //Restoring Character
  197. {
  198. DWORD GUIDtoRestore; DWORD Ones[2];
  199. memcpy(&GUIDtoRestore, Packet,4);
  200. memcpy(&Ones[0], Packet+4,4);
  201. memcpy(&Ones[1], Packet+8,4);
  202. int CharRestoring = 0;
  203. for (int i=0;i<5;i++)
  204. {
  205. if ((ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[i] & 0x7FFFFFFF) == GUIDtoRestore)
  206. {
  207. ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[i] &= 0x7FFFFFFF;
  208. SaveAccounts();
  209. CharRestoring = i;
  210. i = 5;
  211. }
  212. }
  213. BYTE CreateChar[0x100], *PackPointer = &CreateChar[0];
  214. DWORD tpdword;
  215. tpdword = 0x0000F643; memcpy(PackPointer, &tpdword, 4); PackPointer += 4;
  216. tpdword = 0x00000001; memcpy(PackPointer, &tpdword, 4); PackPointer += 4;
  217. tpdword = GUIDtoRestore; memcpy(PackPointer, &tpdword, 4); PackPointer += 4;
  218. tpdword = ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[CharRestoring] & 0x7FFFFFFF;
  219. memcpy(PackPointer,&tpdword,4); PackPointer += 4; //GUID
  220. BYTE NameLen;
  221. NameLen = strlen(ZonePasses[ConnUser[UserParsing].ZoneNum].Names[CharRestoring]) + 1;
  222. memcpy(PackPointer,&NameLen,sizeof(NameLen)); PackPointer += sizeof(NameLen); //NameLen
  223. *PackPointer = 0; PackPointer++; //0
  224. NameLen--; memcpy(PackPointer,&ZonePasses[ConnUser[UserParsing].ZoneNum].Names[CharRestoring],NameLen); PackPointer += NameLen; //Name
  225. *PackPointer = 0; PackPointer++; //0
  226. int Tpl = ((PackPointer-&CreateChar[0])%4); if (Tpl) Tpl=4-Tpl; //Padding
  227. for (int ii=0;ii<Tpl;ii++) { *PackPointer = 0; PackPointer++; } //"
  228. tpdword = 0x00000000; memcpy(PackPointer, &tpdword, 4); PackPointer += 4;
  229. Send200(&CreateChar[0], (int) (PackPointer - &CreateChar[0]), 4, UserParsing);
  230. //Resend Char List!
  231. SendCharList(UserParsing);
  232. }
  233. break;
  234. case 0xF655:
  235. //Deleting Character
  236. {
  237. DWORD beefbeef; char ZoneName[20]; DWORD LastWord[2];
  238. memcpy(&beefbeef, Packet, 4);
  239. memcpy(&ZoneName, Packet+4, 20);
  240. memcpy(&LastWord[1], Packet+24,4);
  241. //LastWord[0] seems to be 01f7 all the time
  242. //LastWord[1] is the index of the char deleted, in order of chars sent, i think...
  243. ZonePasses[ConnUser[UserParsing].ZoneNum].Chars[LastWord[1]] |= 0x80000000; //To be deleted
  244. ZonePasses[ConnUser[UserParsing].ZoneNum].Secs2Del[LastWord[1]] = 300; //5 Minutes
  245. SaveAccounts();
  246. NeedToDelete = true;
  247. //Resend Char List!
  248. SendCharList(UserParsing);
  249. }
  250. break;
  251. case 0xF657:
  252. UpdateCharInfo(UserParsing, "Got Enter game request...");
  253. memcpy(&ConnUser[UserParsing].charGUID, Packet, 4);
  254. ConnUser[UserParsing].State = 3;
  255. break;
  256. case 0xF7B1:
  257. //Game event...
  258. ParseF7B1(UserParsing, *((DWORD *) (Packet+4)), Packet+8, PacketLen - 8);
  259. break;
  260. case 0xF653:
  261. //Exit world..
  262. {
  263. ConnUser[UserParsing].State = 1;
  264. ConnUser[UserParsing].EventCount = 0;
  265. //Disconnect Him
  266. sprintf(sayit, "Player %s Disconnected!", ConnUser[UserParsing].Char->Name);
  267. ServerMessage(GLOBAL_MESSAGE, sayit, COLOR_GREEN);
  268. if (ConnUser[UserParsing].Char)
  269. {
  270. // LBObjects[ConnUser[UserParsing].Char->Loc.landblock >> 16].erase(ConnUser[UserParsing].Char->GUID);
  271. // ObjectList.erase(ConnUser[UserParsing].Char->GUID);
  272. SaveCharacter(UserParsing);
  273. ConnUser[UserParsing].Char = 0;
  274. }
  275. //Return him to char select screen
  276. DWORD tph3 = 0x0000F653;
  277. Send200((BYTE *) &tph3, sizeof(tph3), 4, UserParsing);
  278. SendCharList(UserParsing);
  279. //Delete him from other people
  280. //Somehow...
  281. }
  282. break;
  283. case 0xF6EA:
  284. //Nobody knows...
  285. break;
  286. case 0xF7A9:
  287. //Client needs landblock
  288. ServerMessage(UserParsing, "* You don't have at least one of the landblocks in your new area. !telemap to another location or try typing /render radius 5.", COLOR_RED);
  289. break;
  290. default:
  291. {
  292. char *tps2, *tps3 = new char[1 + PacketLen*5];
  293. ZeroMemory(tps3,1 + PacketLen*5);
  294. tps2 = tps3;
  295. for (unsigned int tpl=0; tpl < PacketLen; tpl++)
  296. {
  297. sprintf(tps2, "0x%02X ", Packet[tpl]);
  298. tps2+=5;
  299. }
  300. sprintf(sayit, "200/%04X Pack Data: %s", MessageType, tps3); LogDisp(sayit);
  301. delete [] tps3;
  302. }
  303. break;
  304. }
  305. }
  306. void cACServer::ParseF7B1(int UserParsing, DWORD MessageType, BYTE *Packet, int PacketLen)
  307. {
  308. if ((!ConnUser[UserParsing].Char) && (MessageType != 0x1F))
  309. return;
  310. switch (MessageType)
  311. {
  312. case 0x001F:
  313. {
  314. ConnUser[UserParsing].State = 4;
  315. DWORD GUIDtoLoad = ConnUser[UserParsing].charGUID;
  316. ServerMessage(UserParsing, "Welcome to KillaServ v-9.432", COLOR_BLUE);
  317. ServerMessage(UserParsing, "* Type !help for a Features List!", COLOR_BLUE);
  318. //Load character...
  319. FILE *charread = fopen("CharList.dat","rb");
  320. if (!charread)
  321. {
  322. //doh
  323. sprintf(sayit, "Couldn't find Character File... Bad... Disconnecting User..."); LogDisp(sayit);
  324. return; //Bad...
  325. }
  326. fseek(charread, 0, SEEK_END);
  327. int numchars = ftell(charread)/(SIZEOFCHAR+68);
  328. fseek(charread, 0, SEEK_SET);
  329. DWORD GUIDtemp; bool CharFound = false;
  330. for (int j=0;j<numchars;j++)
  331. {
  332. fseek(charread, j*(SIZEOFCHAR+68), SEEK_SET);
  333. fread(&GUIDtemp, 4, 1, charread);
  334. if (GUIDtemp == GUIDtoLoad)
  335. {
  336. fseek(charread, j*(SIZEOFCHAR+68), SEEK_SET);
  337. cWorldObject_Char *tpchar = new cWorldObject_Char();
  338. ObjectList[GUIDtemp] = tpchar;
  339. ConnUser[UserParsing].Char = tpchar;
  340. fread(&tpchar->GUID, 4, 1, charread);
  341. fread(tpchar->Name, 32, 1, charread);
  342. fread(&tpchar->Loc, sizeof(Location_t), 1, charread);
  343. BYTE tpl[5000];
  344. fread(tpl, SIZEOFCHAR, 1, charread);
  345. tpchar->LoadFrom(tpl);
  346. j = numchars;
  347. CharFound = true;
  348. }
  349. }
  350. fclose(charread);
  351. if (!CharFound)
  352. {
  353. sprintf(sayit, "Couldn't find Character's Entry... Bad... Disconnecting User..."); LogDisp(sayit);
  354. return; //Bad...
  355. }
  356. LBObjects[ConnUser[UserParsing].Char->Loc.landblock >> 16][ConnUser[UserParsing].Char->GUID] = (cWorldObject *) ConnUser[UserParsing].Char;
  357. //Load Objects out of store...
  358. for (j=0;j<25;j++) {
  359. if (ConnUser[UserParsing].Char->Equipped[j]) {
  360. ConnUser[UserParsing].EquippedPtr[j] = ObjectList[ConnUser[UserParsing].Char->Equipped[j]];
  361. ConnUser[UserParsing].ObjectCache[ConnUser[UserParsing].Char->Equipped[j]] = ConnUser[UserParsing].EquippedPtr[j];
  362. } else j = 25;
  363. }
  364. for (j=0;j<7;j++) {
  365. if (ConnUser[UserParsing].Char->SidePacks[j]) {
  366. ConnUser[UserParsing].SidePacksPtr[j] = ObjectList[ConnUser[UserParsing].Char->SidePacks[j]];
  367. ConnUser[UserParsing].ObjectCache[ConnUser[UserParsing].Char->SidePacks[j]] = ConnUser[UserParsing].SidePacksPtr[j];
  368. } else j = 7;
  369. }
  370. for (j=0;j<102;j++) {
  371. if (ConnUser[UserParsing].Char->MainPack[j]) {
  372. ConnUser[UserParsing].MainPackPtr[j] = ObjectList[ConnUser[UserParsing].Char->MainPack[j]];
  373. ConnUser[UserParsing].ObjectCache[ConnUser[UserParsing].Char->MainPack[j]] = ConnUser[UserParsing].MainPackPtr[j];
  374. } else j = 102;
  375. }
  376. ConnUser[UserParsing].Char->Owner = UserParsing;
  377. //Hax0r...?
  378. ConnUser[UserParsing].Char->NumLogins = 3; //++;
  379. sprintf(sayit, "* Requested Login, Loaded char %08X...", ConnUser[UserParsing].Char->GUID); LogDisp(sayit);
  380. if (UserParsing >= MaxUsers)
  381. MaxUsers = UserParsing+1;
  382. ConnUser[UserParsing].State = 5;
  383. UpdateCharInfo(UserParsing, "Sending Main Login Info...");
  384. //Try to login...
  385. int packlen;
  386. BYTE CharData[0x2000];
  387. //SetPackContents eventually here for any of the 7 packs..
  388. Sleep(500);
  389. //Send giant login packet
  390. packlen = Generate_F7B0_13(CharData, UserParsing);
  391. Send200(CharData, packlen, 4, UserParsing);
  392. Sleep(500);
  393. //Create him on other ppl..
  394. BYTE CreatePlayer[0x2000];
  395. packlen = ConnUser[UserParsing].Char->GenerateCreatePacket(CreatePlayer);
  396. for (int iii=0;iii<MaxUsers;iii++)
  397. {
  398. if ((ConnUser[iii].Connected) && ((ConnUser[iii].State == 6) || (iii == UserParsing)))
  399. Send200(&CreatePlayer[0], packlen, 3, iii);
  400. }
  401. unsigned char LOGIN_CHAR[8] = {
  402. 0x46, 0xF7, 0x00, 0x00, 0x30, 0x9F, 0x03, 0x50, //(F÷__0__P) - 0000
  403. };
  404. memcpy(&LOGIN_CHAR[4],&ConnUser[UserParsing].Char->GUID,4);
  405. Send200(&LOGIN_CHAR[0], sizeof(LOGIN_CHAR), 3, UserParsing);
  406. sprintf(sayit, "Player %s Joined!", ConnUser[UserParsing].Char->Name);
  407. ServerMessage(GLOBAL_MESSAGE, sayit, COLOR_GREEN);
  408. WORD BaseBlock = ConnUser[UserParsing].Char->Loc.landblock >> 16;
  409. SendLandblock(UserParsing, BaseBlock);
  410. SendLandblock(UserParsing, BaseBlock-1);
  411. SendLandblock(UserParsing, BaseBlock+1);
  412. SendLandblock(UserParsing, BaseBlock-256);
  413. SendLandblock(UserParsing, BaseBlock+256);
  414. SendLandblock(UserParsing, BaseBlock-1-256);
  415. SendLandblock(UserParsing, BaseBlock+1-256256);
  416. SendLandblock(UserParsing, BaseBlock-1+256);
  417. SendLandblock(UserParsing, BaseBlock+1+256);
  418. unsigned char MSG_00000002[16] = {
  419. 0x4B, 0xF7, 0x00, 0x00, 0x30, 0x9F, 0x03, 0x50, 0x10, 0x04, 0x40, 0x00, 0x03, 0x00, 0x02, 0x00, //(K÷__0__P__@_____) - 0000
  420. };
  421. //Exit Portal Mode
  422. memcpy(&MSG_00000002[4],&ConnUser[UserParsing].Char->GUID,4);
  423. Send200(&MSG_00000002[0], sizeof(MSG_00000002), 3, UserParsing);
  424. ConnUser[UserParsing].State = 6;
  425. }
  426. break;
  427. case 0xF753:
  428. {
  429. //High-Priority Movement Packet
  430. Location_t *loc = (Location_t *) Packet;
  431. MoveUser(UserParsing, loc, false, false);
  432. }
  433. break;
  434. case 0xF61C:
  435. {
  436. //Low-Priority Movement Packet
  437. if (!ConnUser[UserParsing].Char)
  438. return;
  439. DWORD *hex=(DWORD *)(Packet - 12);
  440. Location_t *loc; DWORD skip = 0;
  441. DWORD hex3;
  442. for (hex3=hex[3];hex3>0;hex3>>=1)
  443. { if (hex3 & 1) skip++; }
  444. //Flags
  445. DWORD SpeedFlag = 0, TurnFlag = 0, SlideFlag = 0, MoveFlag = 0, EmoteFlag = 0;
  446. DWORD * hexat = &hex[4];
  447. cAnimStruct ASt;
  448. ASt.wAnimation_Family = 0x3D;
  449. ASt.wAnimation_to_Play = 0x0;
  450. ASt.fPlaySpeed = 1.0f;
  451. if (hex[3] & 0x00000001)
  452. { //Normal Speed, Unset = Walking
  453. SpeedFlag = *hexat;
  454. hexat += 1; }
  455. if (hex[3] & 0x00000004)
  456. { //Moving
  457. DWORD MoveFlag = *hexat;
  458. hexat += 1;
  459. if (MoveFlag == 0x45000005)
  460. {
  461. ASt.fPlaySpeed = 1.0f;
  462. if (SpeedFlag == 0)
  463. ASt.wAnimation_to_Play = 0x05;
  464. else if (SpeedFlag == 2)
  465. ASt.wAnimation_to_Play = 0x07;
  466. } else if (MoveFlag == 0x45000006) {
  467. ASt.fPlaySpeed = -1.0f;
  468. ASt.wAnimation_to_Play = 0x05;
  469. } else if ((MoveFlag & 0xFF000000) == 0x41000000) {
  470. ASt.wAnimation_to_Play = (WORD) (MoveFlag & 0xFF);
  471. } else if ((MoveFlag & 0xFF000000) == 0x43000000) {
  472. ASt.wAnimation_to_Play = (WORD) (MoveFlag & 0xFF);
  473. } else {
  474. sprintf(sayit, "MoveFlag: %08X", MoveFlag); LogDisp(sayit);
  475. }
  476. }
  477. if (hex[3] & 0x00000020)
  478. { //Sliding
  479. DWORD SlideFlag = *hexat;
  480. hexat += 1;
  481. if (SlideFlag == 0x6500000F)
  482. {
  483. ASt.fPlaySpeed = 1.0f;
  484. ASt.wAnimation_to_Play = 0x0F;
  485. } else if (SlideFlag == 0x65000010) {
  486. ASt.fPlaySpeed = -1.0f;
  487. ASt.wAnimation_to_Play = 0x0F;
  488. }
  489. }
  490. if (hex[3] & 0x00000100)
  491. { //Turning
  492. DWORD TurnFlag = *hexat;
  493. hexat += 1;
  494. if (TurnFlag == 0x6500000D) //Right
  495. {
  496. ASt.fPlaySpeed = 1.0f;
  497. ASt.wAnimation_to_Play = 0x0D;
  498. } else if (TurnFlag == 0x6500000E) { //Left
  499. ASt.fPlaySpeed = -1.0f;
  500. ASt.wAnimation_to_Play = 0x0D;
  501. }
  502. }
  503. if (hex[3] & 0x0000F800)
  504. { //Emote Backlog
  505. DWORD EmoteFlag = *hexat;
  506. DWORD numEmotes = (hex[3] & 0x0000F800) >> 11;
  507. hexat += (numEmotes * 2);
  508. skip += (numEmotes * 2) - 1;
  509. if (numEmotes > 2) //For some reason, on 3+ emotes, it has another DWORD at the end
  510. skip++;
  511. //Just play the first one
  512. ASt.wAnimation_to_Play = (WORD) (EmoteFlag & 0xFF);
  513. if (numEmotes > 1)
  514. {
  515. //Lots of emotes... Learn how to chain later! =]
  516. }
  517. }
  518. loc=(Location_t *)&hex[4+skip];
  519. MoveUser(UserParsing, loc, false, false);
  520. //Make Anim Packet... Ho ho ho!
  521. ASt.dwf74c = 0x0000F74C;
  522. ASt.dwGUID = ConnUser[UserParsing].Char->GUID;
  523. ASt.wNumInteractions = ConnUser[UserParsing].move_count;
  524. ASt.wNumLogins = ConnUser[UserParsing].Char->NumLogins;
  525. ConnUser[UserParsing].AnimCount++;
  526. ASt.wNumAnimations = ConnUser[UserParsing].AnimCount;
  527. ASt.wAnimation_Seqnum = ConnUser[UserParsing].AnimCount;
  528. ASt.wFlag = 0;
  529. ASt.wUnk1 = 0;
  530. ASt.GUIDTarget = 0x00000080;
  531. for (int iii=0;iii<MaxUsers;iii++)
  532. {
  533. if ((ConnUser[iii].Connected) && (ConnUser[iii].State == 6) && (iii != UserParsing))
  534. Send200((BYTE *) &ASt, sizeof(ASt), 3, iii);
  535. }
  536. cAnimStruct AStA;
  537. memcpy(&AStA, &ASt, sizeof(AStA));
  538. AStA.wFlag = 1;
  539. AStA.fPlaySpeed = ASt.fPlaySpeed;
  540. Send200((BYTE *) &AStA, sizeof(AStA), 3, UserParsing);
  541. ConnUser[UserParsing].move_count++;
  542. }
  543. break;
  544. case 0x0008:
  545. {
  546. //Player Attacked
  547. DWORD PlayerAttacked; memcpy(&PlayerAttacked, Packet, 4);
  548. DWORD AttackSpot; memcpy(&AttackSpot, Packet + 4, 4);
  549. DWORD Slider; memcpy(&Slider, Packet + 8, 4);
  550. //Spot: Low/mid/high, 3/2/1
  551. cWorldObject_Char *tpc = (cWorldObject_Char *) ObjectList[PlayerAttacked];
  552. if (tpc)
  553. {
  554. //... bad...?
  555. return;
  556. }
  557. DWORD TotalSkill = ConnUser[UserParsing].Char->SkillInc[0x0D] + (ConnUser[UserParsing].Char->CurrentStat[0] + ConnUser[UserParsing].Char->CurrentStat[2])/3;
  558. DWORD DamageDone = (rand() & 3) + (TotalSkill / 10) + (ConnUser[UserParsing].Char->CurrentStat[0]/20);
  559. tpc->CurrentSecondaryStat[0] -= DamageDone;
  560. //Damage Packet
  561. //Recieve
  562. BYTE DamagePacket[100], *PackPointer = DamagePacket;
  563. DWORD tpd = 0xF7B0; memcpy(PackPointer, &tpd, 4); PackPointer += 4;
  564. memcpy(PackPointer, &tpc->GUID, 4); PackPointer += 4;
  565. memcpy(PackPointer, &ConnUser[tpc->Owner].EventCount, 4); PackPointer += 4;
  566. tpd = 0x01b2; memcpy(PackPointer, &tpd, 4); PackPointer += 4; //13 = Login Char
  567. ConnUser[tpc->Owner].EventCount++;
  568. int strlen; GenString(ConnUser[UserParsing].Char->Name, &strlen, PackPointer); PackPointer += strlen;
  569. DWORD damage = 4; memcpy(PackPointer, &damage, 4); PackPointer += 4;
  570. double severity = 0.5f; memcpy(PackPointer, &severity, 8); PackPointer += 8;
  571. memcpy(PackPointer, &DamageDone, 4); PackPointer += 4;
  572. Send200(DamagePacket, (DWORD) PackPointer - (DWORD) DamagePacket, 4, tpc->Owner);
  573. //Inflict
  574. PackPointer = DamagePacket;
  575. tpd = 0xF7B0; memcpy(PackPointer, &tpd, 4); PackPointer += 4;
  576. memcpy(PackPointer, &ConnUser[UserParsing].Char->GUID, 4); PackPointer += 4;
  577. memcpy(PackPointer, &ConnUser[UserParsing].EventCount, 4); PackPointer += 4;
  578. tpd = 0x01b1; memcpy(PackPointer, &tpd, 4); PackPointer += 4; //13 = Login Char
  579. ConnUser[UserParsing].EventCount++;
  580. GenString(tpc->Name, &strlen, PackPointer); PackPointer += strlen;
  581. memcpy(PackPointer, &damage, 4); PackPointer += 4;
  582. memcpy(PackPointer, &severity, 8); PackPointer += 8;
  583. memcpy(PackPointer, &DamageDone, 4); PackPointer += 4;
  584. DWORD spot;
  585. switch (AttackSpot)
  586. {
  587. case 1:
  588. //High
  589. spot = rand() & 1;
  590. break;
  591. case 2:
  592. //Mid
  593. spot = 1 + (rand() % 5);
  594. break;
  595. case 3:
  596. //Low
  597. spot = 7 + (rand() & 1);
  598. break;
  599. }
  600. memcpy(PackPointer, &spot, 4); PackPointer += 4;
  601. Send200(DamagePacket, (DWORD) PackPointer - (DWORD) DamagePacket - 4, 4, UserParsing);
  602. //Attack Completed
  603. DWORD tp1a7[] = {
  604. 0x0000F7B0,
  605. ConnUser[UserParsing].Char->GUID,
  606. ConnUser[UserParsing].EventCount,
  607. 0x01A7,
  608. ConnUser[UserParsing].AttackCount
  609. };
  610. Send200((BYTE *) tp1a7, sizeof(tp1a7), 4, UserParsing);
  611. ConnUser[UserParsing].AttackCount++;
  612. ConnUser[UserParsing].EventCount++;
  613. if ((int) tpc->CurrentSecondaryStat[0] <= 0)
  614. {
  615. //Dead ktnxunf
  616. sprintf(sayit, "%s was 0wn3d by %s!", tpc->Name, ConnUser[UserParsing].Char->Name);
  617. ServerMessage(GLOBAL_MESSAGE, sayit, COLOR_GREEN);
  618. tpc->CurrentSecondaryStat[0] = (tpc->CurrentStat[1]/2) + tpc->SecondaryStatInc[0];
  619. MoveUser(tpc->Owner, &tpc->LSTie, true, false);
  620. }
  621. }
  622. break;
  623. case 0x0044:
  624. {
  625. //Player raised secondary stat
  626. //DWORD 1 = stat number?
  627. //DWORD 2 = ?
  628. DWORD dword1; memcpy(&dword1, Packet, 4);
  629. DWORD dword2; memcpy(&dword2, Packet + 4, 4);
  630. dword1--;
  631. dword1 >>= 1;
  632. DWORD oldv = ConnUser[UserParsing].Char->SecondaryStatInc[dword1];
  633. ConnUser[UserParsing].Char->UnassignedXP -= SecondaryStatArray[oldv+1] - ConnUser[UserParsing].Char->XPIntoSecondaryStat[dword1];
  634. ConnUser[UserParsing].Char->SecondaryStatInc[dword1]++;
  635. ConnUser[UserParsing].Char->XPIntoSecondaryStat[dword1] = SecondaryStatArray[oldv+1];
  636. DWORD tpdword; BYTE tpbyte;
  637. //Unassigned XP update
  638. BYTE Pack237[200];
  639. ZeroMemory(Pack237, 0xD);
  640. tpdword = 0x237; memcpy(&Pack237[0], &tpdword, 4);
  641. tpbyte = ConnUser[UserParsing].Count237[0x16]; memcpy(&Pack237[4], &tpbyte, 1);
  642. tpdword = 0x16; memcpy(&Pack237[5], &tpdword, 4); //Unassigned XP
  643. tpdword = ConnUser[UserParsing].Char->UnassignedXP; memcpy(&Pack237[9], &tpdword, 4);
  644. Send200(Pack237, 13, 4, UserParsing);
  645. ConnUser[UserParsing].Count237[0x16]++;
  646. UpdateSecondaryStat(UserParsing, dword1);
  647. //Notice
  648. char SrvMsg[100]; sprintf(SrvMsg, "Your base %s is now %i!", SecondaryStatName[dword1], ConnUser[UserParsing].Char->BaseSecondaryStat[dword1]);
  649. ServerMessage(UserParsing, SrvMsg, COLOR_BLUE);
  650. SendSound(UserParsing, 0x76, 1.0f);
  651. }
  652. break;
  653. case 0x0045:
  654. {
  655. //Player raised stat
  656. //DWORD 1 = stat number?
  657. //DWORD 2 = ?
  658. DWORD dword1; memcpy(&dword1, Packet, 4);
  659. DWORD dword2; memcpy(&dword2, Packet + 4, 4);
  660. dword1--;
  661. if (dword1 == 3) dword1 = 2;
  662. else if (dword1 == 2) dword1 = 3;
  663. DWORD oldv = ConnUser[UserParsing].Char->CurrentStat[dword1] - ConnUser[UserParsing].Char->InitialStat[dword1];
  664. ConnUser[UserParsing].Char->UnassignedXP -= PrimStatArray[oldv+1] - ConnUser[UserParsing].Char->XPIntoStat[dword1];
  665. ConnUser[UserParsing].Char->CurrentStat[dword1]++;
  666. ConnUser[UserParsing].Char->XPIntoStat[dword1] = PrimStatArray[oldv+1];
  667. DWORD tpdword; BYTE tpbyte;
  668. //Unassigned XP update
  669. BYTE Pack237[200];
  670. ZeroMemory(Pack237, 0xD);
  671. tpdword = 0x237; memcpy(&Pack237[0], &tpdword, 4);
  672. tpbyte = ConnUser[UserParsing].Count237[0x16]; memcpy(&Pack237[4], &tpbyte, 1);
  673. tpdword = 0x16; memcpy(&Pack237[5], &tpdword, 4); //Unassigned XP
  674. tpdword = ConnUser[UserParsing].Char->UnassignedXP; memcpy(&Pack237[9], &tpdword, 4);
  675. Send200(Pack237, 13, 4, UserParsing);
  676. ConnUser[UserParsing].Count237[0x16]++;
  677. UpdateStat(UserParsing, dword1);
  678. //Notice
  679. char SrvMsg[100]; sprintf(SrvMsg, "Your base %s is now %i!", StatName[dword1], ConnUser[UserParsing].Char->CurrentStat[dword1]);
  680. ServerMessage(UserParsing, SrvMsg, COLOR_BLUE);
  681. SendSound(UserParsing, 0x76, 1.0f);
  682. }
  683. break;
  684. case 0x0046:
  685. {
  686. //Player raised skill
  687. //DWORD 1 = skill number
  688. //DWORD 2 = ?
  689. DWORD dword1; memcpy(&dword1, Packet, 4);
  690. DWORD dword2; memcpy(&dword2, Packet + 4, 4);
  691. DWORD oldv = ConnUser[UserParsing].Char->SkillInc[dword1];
  692. if (ConnUser[UserParsing].Char->SkillTrain[dword1] == 3)
  693. {
  694. ConnUser[UserParsing].Char->UnassignedXP -= SpecSkillArray[oldv+1] - ConnUser[UserParsing].Char->SkillXP[dword1] - ConnUser[UserParsing].Char->SkillFreeXP[dword1];
  695. ConnUser[UserParsing].Char->SkillInc[dword1]++;
  696. ConnUser[UserParsing].Char->SkillXP[dword1] = SpecSkillArray[oldv+1] - ConnUser[UserParsing].Char->SkillFreeXP[dword1];
  697. } else {
  698. ConnUser[UserParsing].Char->UnassignedXP -= TrainedSkillArray[oldv+1] - ConnUser[UserParsing].Char->SkillXP[dword1] - ConnUser[UserParsing].Char->SkillFreeXP[dword1];
  699. ConnUser[UserParsing].Char->SkillInc[dword1]++;
  700. ConnUser[UserParsing].Char->SkillXP[dword1] = TrainedSkillArray[oldv+1] - ConnUser[UserParsing].Char->SkillFreeXP[dword1];
  701. }
  702. DWORD tpdword; BYTE tpbyte;
  703. //Unassigned XP update
  704. BYTE Pack237[200];
  705. ZeroMemory(Pack237, 0xD);
  706. tpdword = 0x237; memcpy(&Pack237[0], &tpdword, 4);
  707. tpbyte = ConnUser[UserParsing].Count237[0x16]; memcpy(&Pack237[4], &tpbyte, 1);
  708. tpdword = 0x16; memcpy(&Pack237[5], &tpdword, 4); //Unassigned XP
  709. tpdword = ConnUser[UserParsing].Char->UnassignedXP; memcpy(&Pack237[9], &tpdword, 4);
  710. Send200(Pack237, 13, 4, UserParsing);
  711. ConnUser[UserParsing].Count237[0x16]++;
  712. UpdateSkill(UserParsing, dword1);
  713. //Notice
  714. char SrvMsg[100]; sprintf(SrvMsg, "Your base %s skill is now %i!", SkillInfo[dword1].Name, ConnUser[UserParsing].Char->SkillBase[dword1]);
  715. ServerMessage(UserParsing, SrvMsg, COLOR_BLUE);
  716. SendSound(UserParsing, 0x76, 1.0f);
  717. }
  718. break;
  719. case 0x0047:
  720. {
  721. //Player trained skill
  722. //DWORD 1 = skill number
  723. //DWORD 2 = ?
  724. DWORD dword1; memcpy(&dword1, Packet, 4);
  725. DWORD dword2; memcpy(&dword2, Packet + 4, 4);
  726. //subtract skill points
  727. ConnUser[UserParsing].Char->SkillCredits -= CreditCost[dword1];
  728. //raise skill to trained
  729. ConnUser[UserParsing].Char->SkillTrain[dword1] = 2;
  730. //Skill credit number
  731. BYTE Pack237[0xD];
  732. DWORD tpdword; BYTE tpbyte;
  733. ZeroMemory(Pack237, 0xD);
  734. tpdword = 0x237; memcpy(&Pack237[0], &tpdword, 4);
  735. tpbyte = ConnUser[UserParsing].Count237[0x18]; memcpy(&Pack237[4], &tpbyte, 1);
  736. tpdword = 0x18; memcpy(&Pack237[5], &tpdword, 4); //Credits
  737. tpdword = ConnUser[UserParsing].Char->SkillCredits; memcpy(&Pack237[9], &tpdword, 4);
  738. Send200(Pack237, 13, 4, UserParsing);
  739. ConnUser[UserParsing].Count237[0x18]++;
  740. UpdateSkill(UserParsing, dword1);
  741. SendSound(UserParsing, 0x76, 1.0f);
  742. }
  743. break;
  744. case 0x0036:
  745. {
  746. //Player used item
  747. DWORD tpguid; memcpy(&tpguid, Packet, 4);
  748. cWorldObject * tpitem = ObjectList[tpguid];
  749. switch (tpitem->Type)
  750. {
  751. case OBJECT_LIFESTONE:
  752. memcpy(&ConnUser[UserParsing].Char->LSTie, &ConnUser[UserParsing].Char->Loc, sizeof(Location_t));
  753. ServerMessage(UserParsing, "You successfully tie to the lifestone!", COLOR_BLUE);
  754. SendAnim(UserParsing, 0x0036, 1.0f);
  755. break;
  756. case OBJECT_PORTAL:
  757. PointAt(UserParsing, tpguid);
  758. // SendAnim(UserParsing, 7); //Run
  759. // ActionComplete(UserParsing);
  760. break;
  761. }
  762. }
  763. break;
  764. case 0x0063:
  765. //Player /lifestoned :)
  766. sprintf(sayit, "%s died!", ConnUser[UserParsing].Char->Name);
  767. ServerMessage(GLOBAL_MESSAGE, sayit, COLOR_GREEN);
  768. // SendAnim(UserParsing, 0x0008);
  769. MoveUser(UserParsing, &ConnUser[UserParsing].Char->LSTie, true, false);
  770. break;
  771. case 0x00A1:
  772. {
  773. //Character logged in...
  774. UpdateCharInfo(UserParsing, "Fully Logged In");
  775. //Fully log him in on others
  776. DWORD F74B[] = {
  777. 0x0000F74B,
  778. ConnUser[UserParsing].Char->GUID,
  779. 0x00400410,
  780. 0x00020003
  781. };
  782. // memcpy(&F74B[3], &ConnUser[UserParsing].Char->NumLogins, 2);
  783. // memcpy((&F74B[3]) + 2, &ConnUser[UserParsing].PortalCount, 2);
  784. for (int iii=0;iii<MaxUsers;iii++)
  785. {
  786. if ((ConnUser[iii].Connected) && (ConnUser[iii].State == 6))
  787. Send200((BYTE *) F74B, sizeof(F74B), 3, iii);
  788. }
  789. BYTE CreatePlayer[0x500]; int packlen;
  790. for (iii=0;iii<MaxUsers;iii++)
  791. {
  792. if ((ConnUser[iii].Connected) && (ConnUser[iii].State == 6) && (iii != UserParsing))
  793. {
  794. packlen = ConnUser[iii].Char->GenerateCreatePacket(CreatePlayer);
  795. //Show others on him
  796. Send200(CreatePlayer, packlen, 3, UserParsing);
  797. memcpy(&F74B[1], &ConnUser[iii].Char->GUID, 4);
  798. Send200((BYTE *) &F74B[0], sizeof(F74B), 3, UserParsing);
  799. }
  800. }
  801. }
  802. break;
  803. case 0x0015:
  804. {
  805. //Text Message from Client
  806. if (PacketLen > 0)
  807. {
  808. char messagetext[2000];
  809. memcpy(messagetext,Packet+2,PacketLen-2);
  810. if (*messagetext == '!')
  811. {
  812. //Command
  813. char command[50], *Contents; ZeroMemory(command, 50);
  814. // char seps[] = " ";
  815. if (strstr(messagetext, " "))
  816. {
  817. memcpy(command,messagetext,(DWORD) strstr(messagetext, " ") - (DWORD) messagetext);
  818. Contents = strstr(messagetext," ");
  819. } else {
  820. memcpy(command,messagetext,strlen(messagetext));
  821. Contents = 0;
  822. }
  823. if (Contents)
  824. Contents = strstr(Contents, " ") + 1;
  825. int NumParms = 0;
  826. char Parms[10][50]; ZeroMemory(Parms, 10*50);
  827. if ((DWORD) Contents > 1)
  828. {
  829. char *tp = Contents, *tp2;
  830. while ((DWORD) tp > 1)
  831. {
  832. tp2 = strstr(tp," ") + 1;
  833. if ((DWORD) tp2 <= 1)
  834. {
  835. memcpy(Parms[NumParms], tp, strlen(tp));
  836. NumParms++;
  837. tp = tp2;
  838. } else {
  839. memcpy(Parms[NumParms], tp, (DWORD) (tp2 - tp - 1));
  840. NumParms++;
  841. tp = tp2;
  842. }
  843. }
  844. }
  845. if (stricmp(&command[1],"tele") == 0) //Teleport by landblock
  846. {
  847. try {
  848. Location_t templ;
  849. memcpy(&templ, &ConnUser[UserParsing].Char->Loc, sizeof(Location_t));
  850. if (NumParms < 4)
  851. {
  852. ServerMessage(UserParsing, "Error in !tele syntax, check !help!", COLOR_RED);
  853. return;
  854. }
  855. //Fill in new Loc...
  856. sscanf(Parms[0],"%f",&templ.x);
  857. sscanf(Parms[1],"%f",&templ.y);
  858. sscanf(Parms[2],"%f",&templ.z);
  859. sscanf(Parms[3],"%08X",&templ.landblock);
  860. MoveUser(UserParsing, &templ, true, false);
  861. } catch (char *) {
  862. ServerMessage(UserParsing, "Error in !tele syntax, check !help...", COLOR_RED);
  863. return;
  864. }
  865. } else if (stricmp(&command[1],"destroy") == 0) {
  866. RemoveItem(ConnUser[UserParsing].SelectedItem);
  867. cWorldObject *hm = ObjectList[ConnUser[UserParsing].SelectedItem];
  868. } else if (stricmp(&command[1],"destroyo") == 0) {
  869. DWORD tpgr;
  870. sscanf(Parms[0], "%08X", &tpgr);
  871. cWorldObject *hm = ObjectList[tpgr];
  872. if (hm)
  873. RemoveItem(hm->GUID);
  874. } else if (stricmp(&command[1],"testswap") == 0) {
  875. BYTE F625[500], *PP = F625;
  876. //F625
  877. *((DWORD *)PP) = 0xF625; PP += 4;
  878. //Header
  879. *((BYTE *)PP) = 0x11; PP += 1;
  880. *((BYTE *)PP) = 3; PP += 1;
  881. *((BYTE *)PP) = 4; PP += 1;
  882. *((BYTE *)PP) = 17; PP += 1;
  883. //PaletteSwaps
  884. *((WORD *)PP) = 0x007E; PP += 2;
  885. *((BYTE *)PP) = 0xAD; PP += 1;
  886. *((BYTE *)PP) = 0x04; PP += 1;
  887. *((WORD *)PP) = 0x1800; PP += 2;
  888. *((BYTE *)PP) = 0xF9; PP += 1;
  889. *((BYTE *)PP) = 0x02; PP += 1;
  890. *((WORD *)PP) = 0x0818; PP += 2;
  891. *((BYTE *)PP) = 0xAF; PP += 1;
  892. *((BYTE *)PP) = 0x04; PP += 1;
  893. //PaletteUnknown
  894. *((WORD *)PP) = 0x0820; PP += 2;
  895. //TextureSwaps
  896. *((BYTE *)PP) = 10; PP += 1;
  897. *((WORD *)PP) = 0x0098; PP += 2;
  898. *((WORD *)PP) = 0x11FD; PP += 2;
  899. *((BYTE *)PP) = 10; PP += 1;
  900. *((WORD *)PP) = 0x024C; PP += 2;
  901. *((WORD *)PP) = 0x1154; PP += 2;
  902. *((BYTE *)PP) = 10; PP += 1;
  903. *((WORD *)PP) = 0x02F5; PP += 2;
  904. *((WORD *)PP) = 0x1157; PP += 2;
  905. *((BYTE *)PP) = 10; PP += 1;
  906. *((WORD *)PP) = 0x025C; PP += 2;
  907. *((WORD *)PP) = 0x11DB; PP += 2;
  908. //ModelSwaps
  909. *((BYTE *)PP) = 0; PP += 1;
  910. *((WORD *)PP) = 0x004E; PP += 2;
  911. *((BYTE *)PP) = 1; PP += 1;
  912. *((WORD *)PP) = 0x004F; PP += 2;
  913. *((BYTE *)PP) = 2; PP += 1;
  914. *((WORD *)PP) = 0x004D; PP += 2;
  915. *((BYTE *)PP) = 5; PP += 1;
  916. *((WORD *)PP) = 0x0053; PP += 2;
  917. *((BYTE *)PP) = 6; PP += 1;
  918. *((WORD *)PP) = 0x0051; PP += 2;
  919. *((BYTE *)PP) = 9; PP += 1;
  920. *((WORD *)PP) = 0x0054; PP += 2;
  921. *((BYTE *)PP) = 0xA; PP += 1;
  922. *((WORD *)PP) = 0x0497; PP += 2;
  923. *((BYTE *)PP) = 0xB; PP += 1;
  924. *((WORD *)PP) = 0x0495; PP += 2;
  925. *((BYTE *)PP) = 0xC; PP += 1;
  926. *((WORD *)PP) = 0x0076; PP += 2;
  927. *((BYTE *)PP) = 0xD; PP += 1;
  928. *((WORD *)PP) = 0x04AD; PP += 2;
  929. *((BYTE *)PP) = 0xE; PP += 1;
  930. *((WORD *)PP) = 0x0496; PP += 2;
  931. *((BYTE *)PP) = 0xF; PP += 1;
  932. *((WORD *)PP) = 0x0077; PP += 2;
  933. *((BYTE *)PP) = 3; PP += 1;
  934. *((WORD *)PP) = 0x004C; PP += 2;
  935. *((BYTE *)PP) = 7; PP += 1;
  936. *((WORD *)PP) = 0x0050; PP += 2;
  937. *((BYTE *)PP) = 4; PP += 1;
  938. *((WORD *)PP) = 0x004B; PP += 2;
  939. *((BYTE *)PP) = 8; PP += 1;
  940. *((WORD *)PP) = 0x0052; PP += 2;
  941. *((BYTE *)PP) = 0x10; PP += 1;
  942. *((WORD *)PP) = 0x049E; PP += 2;
  943. //ModelSequenceType
  944. *((WORD *)PP) = 0x0564; PP += 2;
  945. //ModelSequence
  946. *((WORD *)PP) = ConnUser[UserParsing].ModelCount; PP += 2;
  947. for (int i=1;i<10;i++)
  948. Send200(F625, (int) (PP - F625), i, UserParsing);
  949. } else if (stricmp(&command[1],"tswap") == 0) {
  950. int A, B, C;
  951. sscanf(Parms[0], "%02X", &A);
  952. sscanf(Parms[1], "%04X", &B);
  953. sscanf(Parms[2], "%04X", &C);
  954. ConnUser[UserParsing].Char->OldTexSwap[A] = B;
  955. ConnUser[UserParsing].Char->TexSwap[A] = C;
  956. BYTE hehe[0x500]; int pl = ConnUser[UserParsing].Char->GenerateTexChangePacket(hehe);
  957. Send200(hehe, pl, 3, UserParsing);
  958. Send200(hehe, pl, 4, UserParsing);
  959. } else if (stricmp(&command[1],"telemap") == 0) {
  960. try {
  961. if (NumParms < 2)
  962. {
  963. ServerMessage(UserParsing, "Error in !telemap syntax, check !help!", COLOR_RED);
  964. return;
  965. }
  966. float NS, EW;//, Nx, Ny;
  967. char tpt;
  968. tpt = Parms[0][strlen(Parms[0])-1];
  969. Parms[0][strlen(Parms[0])-1] = 0;
  970. if ((tpt == 'N') || (tpt == 'n'))
  971. {
  972. sscanf(Parms[0],"%f",&NS);
  973. } else if ((tpt == 'S') || (tpt == 's')) {
  974. sscanf(Parms[0],"%f",&NS);
  975. NS *= -1;
  976. } else {
  977. NS = 0;
  978. }
  979. tpt = Parms[1][strlen(Parms[1])-1];
  980. Parms[1][strlen(Parms[1])-1] = 0;
  981. if ((tpt == 'E') || (tpt == 'e'))
  982. {
  983. sscanf(Parms[1],"%f",&EW);
  984. } else if ((tpt == 'W') || (tpt == 'w')) {
  985. sscanf(Parms[1],"%f",&EW);
  986. EW *= -1;
  987. } else {
  988. EW = 0;
  989. }
  990. Location_t templ;
  991. templ.x = (EW*10.0f+1020.0f)*24.0f;
  992. templ.y = (NS*10.0f-1020.0f)*24.0f;
  993. if (NumParms == 3)
  994. sscanf(Parms[2], "%f", &templ.z);
  995. else
  996. templ.z = 0.0f;
  997. templ.landblock =
  998. ( (BYTE) ((((DWORD) templ.x%192)/24)*8) + (((DWORD) templ.y%192)/24) ) |
  999. ( (0x00) << 8) |
  1000. ( (BYTE) (templ.y/192.0f) << 16) |
  1001. ( (BYTE) (templ.x/192.0f) << 24)
  1002. ;
  1003. templ.landblock -= 0x00010000;
  1004. templ.x = (float) ((int) templ.x % 192);
  1005. templ.y = (float) ((int) templ.y % 192);
  1006. MoveUser(UserParsing, &templ, true, false);
  1007. } catch (char *) {
  1008. ServerMessage(UserParsing, "Error in !telemap syntax, check !help...", COLOR_RED);
  1009. return;
  1010. }
  1011. } else if (stricmp(&command[1],"srvmsg") == 0) {
  1012. try {
  1013. sprintf(sayit, "Server Message from %s: %s", ConnUser[UserParsing].Char->Name, Contents);
  1014. ServerMessage(GLOBAL_MESSAGE, sayit, COLOR_GREEN);
  1015. } catch (char *) {
  1016. ServerMessage(UserParsing, "Error in !srvmsg syntax, check !help...", COLOR_RED);
  1017. return;
  1018. }
  1019. } else if (stricmp(&command[1],"who") == 0) {
  1020. //Send list of people
  1021. ServerMessage(UserParsing, "Listing Players:", COLOR_GREEN);
  1022. for (int i=0;i<MaxUsers;i++)
  1023. {
  1024. if (ConnUser[i].Connected)
  1025. {
  1026. if (ConnUser[i].Char)
  1027. {
  1028. sprintf(sayit, "* %i - %i.%i.%i.%i:%i - %s - %s",
  1029. i,
  1030. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b1,
  1031. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b2,
  1032. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b3,
  1033. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b4,
  1034. ntohs(ConnUser[i].sockaddy.sin_port),
  1035. ConnUser[i].Char->Name,
  1036. ConnUser[i].Status);
  1037. } else {
  1038. sprintf(sayit, "* %i - %i.%i.%i.%i:%i - %s - %s",
  1039. i,
  1040. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b1,
  1041. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b2,
  1042. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b3,
  1043. ConnUser[i].sockaddy.sin_addr.S_un.S_un_b.s_b4,
  1044. ntohs(ConnUser[i].sockaddy.sin_port),
  1045. "*At Char Select*",
  1046. ConnUser[i].Status);
  1047. }
  1048. ServerMessage(UserParsing, sayit, COLOR_GREEN);
  1049. }
  1050. }
  1051. } else if (stricmp(&command[1],"kick") == 0) {
  1052. try {
  1053. DWORD tokick;
  1054. sscanf(Contents, "%i", &tokick);
  1055. if ((tokick < 128) && (ConnUser[tokick].Connected))
  1056. {
  1057. DisconnectUser(tokick);
  1058. } else {
  1059. //Try by name...
  1060. for (int ii=0;ii<MaxUsers;ii++)
  1061. {
  1062. if (stricmp(Contents, ConnUser[ii].Char->Name) == 0)
  1063. { DisconnectUser(ii); break; }
  1064. }
  1065. }
  1066. } catch (char *) {
  1067. ServerMessage(UserParsing, "Error in !kick syntax, check !help...", COLOR_RED);
  1068. return;
  1069. }
  1070. } else if (stricmp(&command[1],"help") == 0) {
  1071. if (NumParms == 0)
  1072. {
  1073. ServerMessage(UserParsing, "ACServer Help:", COLOR_BLUE);
  1074. ServerMessage(UserParsing, "Use !help [section] to get help on a section of commands...", COLOR_YELLOW);
  1075. ServerMessage(UserParsing, " * Teleport - Basic teleporting commands\n\
  1076. * Admin - Administrator Commands\n\
  1077. * Effects - Special Effect Commands\n\
  1078. * Avatar - Commands to mess with your avatar", COLOR_YELLOW);
  1079. } else {
  1080. if (stricmp(Parms[0],"teleport") == 0)
  1081. {
  1082. ServerMessage(UserParsing, "-=* Teleport *=-", COLOR_YELLOW);
  1083. ServerMessage(UserParsing, " * !tele [X] [Y] [Z] [Landblock] - Teleport by Location_T\n\
  1084. * !telemap [xx.xN/S] [xx.xE/W] [(Z)] - Teleport by NSEW coords with optional Z\n\
  1085. * !telemapother [player number] [xx.xN/S] [xx.xE/W] [(Z)] - Teleports [player number] by NSEW coords with optional Z\n\
  1086. * !goto [player number] - Teleports you to [player number]\n\
  1087. * !summon [player number] - Summons [player number] to you", COLOR_GREEN);
  1088. }
  1089. else if (stricmp(Parms[0],"admin") == 0)
  1090. {
  1091. ServerMessage(UserParsing, "-=* Admin *=-", COLOR_YELLOW);
  1092. ServerMessage(UserParsing, " * !givexp [player number] [Amount] - Give player unassigned XP\n\
  1093. * !setskillinc [player number] [skill number] [new inc] - Changes player's skill increase number\n\
  1094. * !srvmsg [message] - Server Message\n\
  1095. * !kick [player number] - Kick player by number\n\
  1096. * !create [named item] - Create Objects. Use '!create help' for specific syntax\n\
  1097. * !smite [player number] - Hmmm...\n \
  1098. * !who - List of Users Online (Gets Player Numbers)", COLOR_GREEN);
  1099. }
  1100. else if (stricmp(Parms[0],"effects") == 0)
  1101. {
  1102. ServerMessage(UserParsing, "-=* Effects *=-", COLOR_YELLOW);
  1103. ServerMessage(UserParsing, " * !anim [anim number (0 to FFFF, hex)] - Make your character do animations\n\
  1104. * !sound [sound number (0 to FFFF, hex)] - Make sound effects come from your character\n\
  1105. * !particle [particle number (0 to FFFF, hex)] - Make particle effects come from your character", COLOR_GREEN);
  1106. }
  1107. else if (stricmp(Parms[0],"avatar") == 0)
  1108. {
  1109. ServerMessage(UserParsing, "-=* Avatar *=-", COLOR_YELLOW);
  1110. ServerMessage(UserParsing, " * !changename [new name] - Change Player Name\n\
  1111. * !changetitle [new title] - Changes your character title\n\
  1112. * !changescale [new scale] - Changes the scale of your avatar model\n\
  1113. * !changemodel [new model #] - Change your character to this model #", COLOR_GREEN);
  1114. }
  1115. else
  1116. {
  1117. ServerMessage(UserParsing, "Invalid Help Section, see !help...", COLOR_RED);
  1118. }
  1119. }
  1120. } else if (stricmp(&command[1],"changemodel") == 0) {
  1121. WORD NewModel;
  1122. sscanf(Parms[0], "%i", &NewModel);
  1123. ConnUser[UserParsing].Char->Model = NewModel;
  1124. ServerMessage(UserParsing, "Model changed! Relog to see the effect...", COLOR_RED);
  1125. } else if (stricmp(&command[1],"changescale") == 0) {
  1126. float NewScale;
  1127. sscanf(Parms[0], "%f", &NewScale);
  1128. ConnUser[UserParsing].Char->Scale = NewScale;
  1129. ServerMessage(UserParsing, "Scale changed! Relog to see the effect...", COLOR_RED);
  1130. } else if (stricmp(&command[1],"changetitle") == 0) {
  1131. memcpy(ConnUser[UserParsing].Char->Title, Contents, 32);
  1132. ServerMessage(UserParsing, "Title changed! Relog to see the effect...", COLOR_RED);
  1133. } else if (stricmp(&command[1],"changename") == 0) {
  1134. char NewName[32];
  1135. memcpy(NewName, Contents, 32);
  1136. for (int i=0;i<5;i++)
  1137. {
  1138. if (strcmp(ZonePasses[ConnUser[UserParsing].ZoneNum].Names[i],ConnUser[UserParsing].Char->Name) == 0)
  1139. {
  1140. strcpy(ZonePasses[ConnUser[UserParsing].ZoneNum].Names[i], NewName);
  1141. i = 5;
  1142. }
  1143. }
  1144. strcpy(ConnUser[UserParsing].Char->Name, NewName);
  1145. ServerMessage(UserParsing, "Name changed! Relog to see the effect...", COLOR_RED);
  1146. } else if (stricmp(&command[1],"givexp") == 0) {
  1147. DWORD PlayerFor;
  1148. sscanf(Parms[0], "%i", &PlayerFor);
  1149. DWORD AmounttoGive;
  1150. sscanf(Parms[1], "%u", &AmounttoGive);
  1151. if (PlayerFor > 128)
  1152. return;
  1153. GiveXP(PlayerFor, 128, AmounttoGive);
  1154. } else if (stricmp(&command[1],"setskillinc") == 0) {
  1155. DWORD PlayerFor;
  1156. sscanf(Parms[0], "%i", &PlayerFor);
  1157. DWORD SkillNum;
  1158. sscanf(Parms[1], "%i", &SkillNum);
  1159. DWORD AmounttoGive;
  1160. sscanf(Parms[2], "%u", &AmounttoGive);
  1161. if (PlayerFor > 128)
  1162. return;
  1163. if (SkillNum >= 40)
  1164. return;
  1165. if ((ConnUser[PlayerFor].Char) && (ConnUser[PlayerFor].State >= 5))
  1166. {
  1167. ConnUser[PlayerFor].Char->SkillInc[SkillNum] = AmounttoGive;
  1168. UpdateSkill(PlayerFor, SkillNum);
  1169. }
  1170. } else if (stricmp(&command[1],"damage") == 0) {
  1171. BYTE DamagePacket[100], *PackPointer = DamagePacket;
  1172. DWORD head = 0x1b2; memcpy(PackPointer, &head, 4); PackPointer += 4;
  1173. int strlen; GenString("Someone", &strlen, PackPointer); PackPointer += strlen;
  1174. DWORD damage = 4; memcpy(PackPointer, &damage, 4); PackPointer += 4;
  1175. double severity = 0.5f; memcpy(PackPointer, &severity, 8); PackPointer += 8;
  1176. DWORD amount = rand() & 7; memcpy(PackPointer, &amount, 4); PackPointer += 4;
  1177. Send200(DamagePacket, (DWORD) PackPointer - (DWORD) DamagePacket, 4, UserParsing);
  1178. } else if (stricmp(&command[1],"create") == 0) {
  1179. DWORD tpguid; bool freeg = false;
  1180. while (!freeg)
  1181. {
  1182. tpguid = 0x78000000 | ((rand()*rand()) & 0x00FFFFFF);
  1183. if (ObjectList[tpguid] == 0)
  1184. freeg = true;
  1185. }
  1186. if (!Contents)
  1187. {
  1188. ServerMessage(UserParsing, "Try !create help...", COLOR_BLUE);
  1189. return;
  1190. }
  1191. if (stricmp(Contents, "help") == 0)
  1192. {
  1193. ServerMessage(UserParsing, "!create currently supports the following objects: lifestone, obj, portal, portalloc.", COLOR_BLUE);
  1194. ServerMessage(UserParsing, " * Lifestone - Creates a lifestone in front of you\n\
  1195. * Obj - Creates generic objects... See !create obj help\n\
  1196. * Portal [name] [loc] - Creates portal by //loc address, [loc] is same format as !tele\n\
  1197. * Portalloc [name] [loc] - Creates portal by NSEW coords, [loc] is same format as !telemap", COLOR_GREEN);
  1198. } else if (stricmp(Parms[0], "portalloc") == 0) {
  1199. cWorldObject_Portal *tpprt = new cWorldObject_Portal();
  1200. tpprt->GUID = tpguid;
  1201. memcpy(&tpprt->Loc, &ConnUser[UserParsing].Char->Loc, sizeof(Location_t));
  1202. tpprt->Loc.x += 5.0f*ConnUser[UserParsing].PointX;
  1203. tpprt->Loc.y += 5.0f*ConnUser[UserParsing].PointY;
  1204. try {
  1205. if (NumParms < 4)
  1206. {
  1207. ServerMessage(UserParsing, "Error in !create portalloc syntax, check !help!", COLOR_RED);
  1208. return;
  1209. }
  1210. char *usrep = strchr(Parms[1],'_');
  1211. while (usrep)
  1212. {
  1213. *usrep = ' ';
  1214. usrep = strchr(Parms[1],'_');
  1215. }
  1216. strcpy(tpprt->Name, Parms[1]);
  1217. float NS, EW;//, Nx, Ny;
  1218. char tpt;
  1219. tpt = Parms[2][strlen(Parms[2])-1];
  1220. Parms[2][strlen(Parms[2])-1] = 0;
  1221. if ((tpt == 'N') || (tpt == 'n'))
  1222. {
  1223. sscanf(Parms[2],"%f",&NS);
  1224. } else if ((tpt == 'S') || (tpt == 's')) {
  1225. sscanf(Parms[2],"%f",&NS);
  1226. NS *= -1;
  1227. } else {
  1228. NS = 0;
  1229. }
  1230. tpt = Parms[3][strlen(Parms[3])-1];
  1231. Parms[3][strlen(Parms[3])-1] = 0;
  1232. if ((tpt == 'E') || (tpt == 'e'))
  1233. {
  1234. sscanf(Parms[3],"%f",&EW);
  1235. } else if ((tpt == 'W') || (tpt == 'w')) {
  1236. sscanf(Parms[3],"%f",&EW);
  1237. EW *= -1;
  1238. } else {
  1239. EW = 0;
  1240. }
  1241. tpprt->DestLoc.x = (EW*10.0f+1020.0f)*24.0f;
  1242. tpprt->DestLoc.y = (NS*10.0f-1020.0f)*24.0f;
  1243. if (NumParms == 5)
  1244. sscanf(Parms[4], "%f", &tpprt->DestLoc.z);
  1245. else
  1246. tpprt->DestLoc.z = 0;
  1247. tpprt->DestLoc.landblock =
  1248. ( (BYTE) ((((DWORD) tpprt->DestLoc.x%192)/24)*8) + (((DWORD) tpprt->DestLoc.y%192)/24) ) |
  1249. ( (0x00) << 8) |
  1250. ( (BYTE) (tpprt->DestLoc.y/192.0f) << 16) |
  1251. ( (BYTE) (tpprt->DestLoc.x/192.0f) << 24)
  1252. ;
  1253. tpprt->DestLoc.landblock -= 0x00010000;
  1254. tpprt->DestLoc.x = (float) ((int) tpprt->DestLoc.x % 192);
  1255. tpprt->DestLoc.y = (float) ((int) tpprt->DestLoc.y % 192);
  1256. } catch (char *) {
  1257. ServerMessage(UserParsing, "Error in !create portalloc syntax, check !help...", COLOR_RED);
  1258. return;
  1259. }
  1260. LBObjects[tpprt->Loc.landblock >> 16][tpprt->GUID] = (cWorldObject *) tpprt;
  1261. Portals[tpprt->Loc.landblock >> 16][tpprt->GUID] = tpprt;
  1262. ObjectList[tpguid] = (cWorldObject *) tpprt;
  1263. BYTE TpP[500];
  1264. int packlen = tpprt->GenerateCreatePacket(TpP);
  1265. for (int iii=0;iii<MaxUsers;iii++)
  1266. if (ConnUser[iii].Connected)
  1267. Send200(TpP, packlen, 3, iii);
  1268. } else if (stricmp(Parms[0], "portal") == 0) {
  1269. cWorldObject_Portal *tpprt = new cWorldObject_Portal();
  1270. tpprt->GUID = tpguid;
  1271. memcpy(&tpprt->Loc, &ConnUser[UserParsing].Char->Loc, sizeof(Location_t));
  1272. tpprt->Loc.x += 3.0f;
  1273. try {
  1274. if (NumParms < 6)
  1275. {
  1276. ServerMessage(UserParsing, "Error in !create portal syntax, check !help!", COLOR_RED);
  1277. return;
  1278. }
  1279. char *usrep = strchr(Parms[1],'_');
  1280. while (usrep)
  1281. {
  1282. *usrep = ' ';
  1283. usrep = strchr(Parms[1],'_');
  1284. }
  1285. strcpy(tpprt->Name, Parms[1]);
  1286. sscanf(Parms[2],"%f",&tpprt->DestLoc.x);
  1287. sscanf(Parms[3],"%f",&tpprt->DestLoc.y);
  1288. sscanf(Parms[4],"%f",&tpprt->DestLoc.z);
  1289. sscanf(Parms[5],"%08X",&tpprt->DestLoc.landblock);
  1290. } catch (char *) {
  1291. ServerMessage(UserParsing, "Error in !create portal syntax, check !help...", COLOR_RED);
  1292. return;
  1293. }
  1294. LBObjects[tpprt->Loc.landblock >> 16][tpprt->GUID] = (cWorldObject *) tpprt;
  1295. Portals[tpprt->Loc.landblock >> 16][tpprt->GUID] = tpprt;
  1296. ObjectList[tpguid] = (cWorldObject *) tpprt;
  1297. BYTE TpP[500];
  1298. int packlen = tpprt->GenerateCreatePacket(TpP);
  1299. for (int iii=0;iii<MaxUsers;iii++)
  1300. if (ConnUser[iii].Connected)
  1301. Send200(TpP, packlen, 3, iii);
  1302. } else if (stricmp(Parms[0], "lifestone") == 0) {
  1303. cWorldObject_LS *tpls = new cWorldObject_LS();
  1304. tpls->GUID = tpguid;
  1305. tpls->Type = OBJECT_LIFESTONE;
  1306. memcpy(&tpls->Loc, &ConnUser[UserParsing].Char->Loc, sizeof(Location_t));
  1307. tpls->Loc.x += 1.0f;
  1308. LBObjects[tpls->Loc.landblock >> 16][tpls->GUID] = (cWorldObject *) tpls;
  1309. ObjectList[tpguid] = (cWorldObject *) tpls;
  1310. BYTE TpP[500];
  1311. int packlen = tpls->GenerateCreatePacket(TpP);
  1312. for (int iii=0;iii<MaxUsers;iii++)
  1313. if (ConnUser[iii].Connected)
  1314. Send200(TpP, packlen, 3, iii);
  1315. } else if (stricmp(Parms[0], "obj") == 0) {
  1316. if (stricmp(Parms[1], "help") == 0)
  1317. {
  1318. ServerMessage(UserParsing, "Syntax: !create obj -id ** [-name **] [-selectable]", COLOR_BLUE);
  1319. ServerMessage(UserParsing, " * -id *** - Gives the object a Model # of ***\n\
  1320. * -name *** - Names the object this\n\
  1321. * -selectable - Makes the object selectable", COLOR_GREEN);
  1322. return;
  1323. }
  1324. cWorldObject_ObjectID *tpObj = new cWorldObject_ObjectID();
  1325. tpObj->Flags = 0;
  1326. sprintf(tpObj->Name, "Unnamed Object");
  1327. tpObj->Model = 1;
  1328. try {
  1329. int CurParm = 1;
  1330. while (CurParm < NumParms)
  1331. {
  1332. if (stricmp(Parms[CurParm],"-id") == 0)
  1333. {
  1334. sscanf(Parms[CurParm+1], "%i", &tpObj->Model);
  1335. CurParm++;
  1336. }
  1337. else if (stricmp(Parms[CurParm],"-icon") == 0)
  1338. {
  1339. sscanf(Parms[CurParm+1], "%i", &tpObj->Icon);
  1340. CurParm++;
  1341. }
  1342. else if (stricmp(Parms[CurParm],"-scale") == 0)
  1343. {
  1344. sscanf(Parms[CurParm+1], "%f", &tpObj->Scale);
  1345. CurParm++;
  1346. }
  1347. else if (stricmp(Parms[CurParm],"-selectable") == 0)
  1348. {
  1349. tpObj->Flags |= BYOBJ_SELECTABLE;
  1350. }
  1351. else if (stricmp(Parms[CurParm],"-name") == 0)
  1352. {
  1353. sscanf(Parms[CurParm+1], "%s", &tpObj->Name);
  1354. char *usrep = strchr(tpObj->Name,'_');
  1355. while (usrep)
  1356. {
  1357. *usrep = ' ';
  1358. usrep = strchr(tpObj->Name,'_');
  1359. }
  1360. CurParm++;
  1361. }
  1362. CurParm++;
  1363. }
  1364. } catch (...) {
  1365. sprintf(sayit, "Error, check syntax: %s", messagetext);
  1366. ServerMessage(UserParsing, sayit, COLOR_RED);
  1367. }
  1368. sprintf(sayit, "Model Created with ID: %i", tpObj->Model);
  1369. ServerMessage(UserParsing, sayit, COLOR_RED);
  1370. tpObj->GUID = tpguid;
  1371. tpObj->Type = OBJECT_OBJECTID;
  1372. memcpy(&tpObj->Loc, &ConnUser[UserParsing].Char->Loc, sizeof(Location_t));
  1373. tpObj->Loc.x += 5.0f*ConnUser[UserParsing].PointX;
  1374. tpObj->Loc.y += 5.0f*ConnUser[UserParsing].PointY;
  1375. LBObjects[tpObj->Loc.landblock >> 16][tpObj->GUID] = (cWorldObject *) tpObj;
  1376. ObjectList[tpguid] = (cWorldObject *) tpObj;
  1377. BYTE TpP[500];
  1378. int packlen = tpObj->GenerateCreatePacket(TpP);
  1379. for (int iii=0;iii<MaxUsers;iii++)
  1380. if (ConnUser[iii].Connected)
  1381. Send200(TpP, packlen, 3, iii);
  1382. }
  1383. } else if (stricmp(&command[1],"renamesel") == 0) {
  1384. DWORD GUIDtoChange = ConnUser[UserParsing].SelectedItem;
  1385. cWorldObject *newobj = ObjectList[GUIDtoChange];
  1386. if (newobj)
  1387. {
  1388. sprintf(newobj->Name, "%s", Parms[0]);
  1389. sprintf(sayit, "Object %08X renamed to %s!", GUIDtoChange, newobj->Name);
  1390. ServerMessage(UserParsing, sayit, COLOR_BLUE);
  1391. }
  1392. } else if (stricmp(&command[1],"renameobject") == 0) {
  1393. DWORD GUIDtoChange; sscanf(Parms[0], "%08x", &GUIDtoChange);
  1394. cWorldObject *newobj = ObjectList[GUIDtoChange];
  1395. if (newobj)
  1396. {
  1397. sprintf(newobj->Name, "%s", Parms[1]);
  1398. sprintf(sayit, "Object %08X renamed to %s!", GUIDtoChange, newobj->Name);
  1399. ServerMessage(UserParsing, sayit, COLOR_BLUE);
  1400. }
  1401. } else if (stricmp(&command[1],"listobjects") == 0) {
  1402. ServerMessage(UserParsing, "Listing Objects in Current Landblock...", COLOR_BLUE);
  1403. for (std::map<DWORD, cWorldObject *>::iterator i = LBObjects[ConnUser[UserParsing].Char->Loc.landblock >> 16].begin(); i != LBObjects[ConnUser[UserParsing].Char->Loc.landblock >> 16].end(); i++)
  1404. {
  1405. if ((i->second->Type) && (i->second->GUID != ConnUser[UserParsing].Char->GUID))
  1406. {
  1407. sprintf(sayit, "Object: %08X, Type: %i, Name: %s", i->second->GUID, i->second->Type, i->second->Name);
  1408. ServerMessage(UserParsing, sayit, COLOR_BLUE);
  1409. }
  1410. }
  1411. ServerMessage(UserParsing, "End of list!", COLOR_BLUE);
  1412. } else if (stricmp(&command[1],"anim") == 0) {
  1413. try {
  1414. DWORD tpdw;
  1415. sscanf(Contents, "%04X", &tpdw);
  1416. SendAnim(UserParsing, tpdw, 1.0f);
  1417. } catch (char *) {
  1418. ServerMessage(UserParsing, "Error in !anim syntax, check !help...", COLOR_RED);
  1419. return;
  1420. }
  1421. } else if (stricmp(&command[1],"particle") == 0) {
  1422. try {
  1423. DWORD tpdw;
  1424. sscanf(Contents,"%04x",&tpdw);
  1425. SendParticle(UserParsing, tpdw, 1.0f);
  1426. } catch (char *) {
  1427. ServerMessage(UserParsing, "Error in !particle syntax, check !help...", COLOR_RED);
  1428. return;
  1429. }
  1430. } else if (stricmp(&command[1],"sound") == 0) {
  1431. try {
  1432. DWORD tpdw;
  1433. sscanf(Contents,"%04x",&tpdw);
  1434. SendSound(UserParsing, tpdw, 1.0f);
  1435. } catch (char *) {
  1436. ServerMessage(UserParsing, "Error in !particle syntax, check !help...", COLOR_RED);
  1437. return;
  1438. }
  1439. } else if (stricmp(&command[1],"smite") == 0) {
  1440. try {
  1441. DWORD Playertokill;
  1442. sscanf(Contents, "%04X", &Playertokill);
  1443. if (Playertokill > (DWORD) MaxUsers)
  1444. return;
  1445. if (!ConnUser[Playertokill].Char)
  1446. return;
  1447. SendAnim(Playertokill, 0x08, 1.0f);
  1448. sprintf(sayit, "%s smites %s!", ConnUser[UserParsing].Char->Name, ConnUser[Playertokill].Char->Name);
  1449. ServerMessage(GLOBAL_MESSAGE, sayit, COLOR_GREEN);
  1450. } catch (char *) {
  1451. ServerMessage(UserParsing, "Error in !smite syntax, check !help...", COLOR_RED);
  1452. return;
  1453. }
  1454. } else if (stricmp(&command[1],"summon") == 0) {
  1455. DWORD ToAssist;
  1456. try {
  1457. sscanf(Contents, "%i", &ToAssist);
  1458. if ((ToAssist > 128) || (!ConnUser[ToAssist].Connected) || (ConnUser[ToAssist].State < 5))
  1459. {
  1460. ServerMessage(UserParsing, "Invalid User...", COLOR_RED);
  1461. return;
  1462. }
  1463. MoveUser(ToAssist, &ConnUser[UserParsing].Char->Loc, true, false);
  1464. } catch (char *) {
  1465. ServerMessage(UserParsing, "Error in !summon syntax, check !help...", COLOR_RED);
  1466. return;
  1467. }
  1468. } else if (stricmp(&command[1],"goto") == 0) {
  1469. DWORD ToGoto;
  1470. try {
  1471. sscanf(Contents, "%i", &ToGoto);
  1472. if ((ToGoto > 128) || (!ConnUser[ToGoto].Connected) || (ConnUser[ToGoto].State < 5))
  1473. {
  1474. ServerMessage(UserParsing, "Invalid User...", COLOR_RED);
  1475. return;
  1476. }
  1477. MoveUser(UserParsing, &ConnUser[ToGoto].Char->Loc, true, false);
  1478. } catch (char *) {
  1479. ServerMessage(UserParsing, "Error in !goto syntax, check !help...", COLOR_RED);
  1480. return;
  1481. }
  1482. } else if (stricmp(&command[1],"telemapother") == 0) {
  1483. try {
  1484. if (NumParms < 3)
  1485. {
  1486. ServerMessage(UserParsing, "Error in !telemap syntax, check !help!", COLOR_RED);
  1487. return;
  1488. }
  1489. DWORD Chartotele;
  1490. sscanf(Parms[0],"%i",&Chartotele);
  1491. float NS, EW;//, Nx, Ny;
  1492. char tpt;
  1493. tpt = Parms[0][strlen(Parms[1])-1];
  1494. Parms[1][strlen(Parms[1])-1] = 0;
  1495. if ((tpt == 'N') || (tpt == 'n'))
  1496. {
  1497. sscanf(Parms[1],"%f",&NS);
  1498. } else if ((tpt == 'S') || (tpt == 's')) {
  1499. sscanf(Parms[1],"%f",&NS);
  1500. NS *= -1;
  1501. } else {
  1502. NS = 0;
  1503. }
  1504. tpt = Parms[2][strlen(Parms[2])-1];
  1505. Parms[2][strlen(Parms[2])-1] = 0;
  1506. if ((tpt == 'E') || (tpt == 'e'))
  1507. {
  1508. sscanf(Parms[2],"%f",&EW);
  1509. } else if ((tpt == 'W') || (tpt == 'w')) {
  1510. sscanf(Parms[2],"%f",&EW);
  1511. EW *= -1;
  1512. } else {
  1513. EW = 0;
  1514. }
  1515. Location_t templ;
  1516. templ.x = (EW*10.0f+1020.0f)*24.0f;
  1517. templ.y = (NS*10.0f-1020.0f)*24.0f;
  1518. if (NumParms == 4)
  1519. sscanf(Parms[3], "%f", &templ.z);
  1520. else
  1521. templ.z = 500.0f;
  1522. templ.landblock =
  1523. ( (BYTE) ((((DWORD) templ.x%192)/24)*8) + (((DWORD) templ.y%192)/24) ) |
  1524. ( (0x00) << 8) |
  1525. ( (BYTE) (templ.y/192.0f) << 16) |
  1526. ( (BYTE) (templ.x/192.0f) << 24)
  1527. ;
  1528. templ.landblock -= 0x00010000;
  1529. templ.x = (float) ((int) templ.x % 192);
  1530. templ.y = (float) ((int) templ.y % 192);
  1531. MoveUser(Chartotele, &templ, true, false);
  1532. } catch (char *) {
  1533. ServerMessage(UserParsing, "Error in !telemapother syntax, check !help...", COLOR_RED);
  1534. return;
  1535. }
  1536. }
  1537. } else {
  1538. //Actual text message... omgomgmog
  1539. BYTE tpmessage[0x1000]; ZeroMemory(tpmessage, sizeof(tpmessage));
  1540. BYTE * PacketPointer = &tpmessage[0];
  1541. int tplen;
  1542. DWORD tpn = 0x00000037; memcpy(PacketPointer, &tpn, 4); PacketPointer += 4;
  1543. GenString(messagetext, &tplen, PacketPointer); PacketPointer += tplen;
  1544. GenString(&ConnUser[UserParsing].Char->Name[0], &tplen, PacketPointer); PacketPointer += tplen;
  1545. memcpy(PacketPointer, &ConnUser[UserParsing].Char->GUID, 4); PacketPointer += 4;
  1546. tpn = 0x2; memcpy(PacketPointer, &tpn, 4); PacketPointer += 4;
  1547. for (int iii=0;iii<MaxUsers;iii++)
  1548. {
  1549. if ((ConnUser[iii].Connected) && (ConnUser[iii].State == 6))
  1550. Send200(&tpmessage[0], (int) (PacketPointer - &tpmessage[0]), 4, iii);
  1551. }
  1552. }
  1553. // delete [] messagetext;
  1554. }
  1555. }
  1556. break;
  1557. case 0x01DF:
  1558. {
  1559. //Emote!
  1560. char *messagetext = new char[PacketLen-2];
  1561. memcpy(messagetext,Packet + 2,PacketLen-2);
  1562. BYTE tpmessage[0x1000]; ZeroMemory(tpmessage, sizeof(tpmessage));
  1563. BYTE * PacketPointer = &tpmessage[0];
  1564. int tplen;
  1565. DWORD tpn = 0x000001E2;
  1566. memcpy(PacketPointer, &tpn, 4); PacketPointer += 4;
  1567. memcpy(PacketPointer, &ConnUser[UserParsing].Char->GUID, 4); PacketPointer += 4;
  1568. GenString(&ConnUser[UserParsing].Char->Name[0], &tplen, PacketPointer); PacketPointer += tplen;
  1569. GenString(messagetext, &tplen, PacketPointer); PacketPointer += tplen;
  1570. for (int iii=0;iii<MaxUsers;iii++)
  1571. {
  1572. if ((ConnUser[iii].Connected) && (ConnUser[iii].State == 6))
  1573. Send200(&tpmessage[0], (int) (PacketPointer - &tpmessage[0]), 4, iii);
  1574. }
  1575. }
  1576. break;
  1577. case 0x01E1:
  1578. //Emote Text...
  1579. char MsgText[100];
  1580. sprintf(MsgText, "%s %s", ConnUser[UserParsing].Char->Name, Packet+2);
  1581. ServerMessage(-1*(UserParsing+1), &MsgText[0], COLOR_GREY);
  1582. break;
  1583. case 0x0053:
  1584. {
  1585. //Toggle Combat Mode
  1586. //4th dword: 1 = peace, 2 = war
  1587. DWORD CombatMode; memcpy(&CombatMode, Packet, 4);
  1588. if (CombatMode == 1)
  1589. {
  1590. SendAnim(UserParsing, 0x3b, 1.0f);
  1591. } else {
  1592. if (ConnUser[UserParsing].Char->Equipped[EQUIPPED_WEAPON] == 0)
  1593. {
  1594. //Punching
  1595. SendAnim(UserParsing, 0x3c, 1.0f);
  1596. } else {
  1597. // cWorldObject_Weapon *WeaponUsing = (cWorldObject_Weapon *) ConnUser[UserParsing].ObjectCache[ConnUser[UserParsing].Char->Equipped[EQUIPPED_WEAPON]];
  1598. // if (!WeaponUsing)
  1599. // WeaponUsing = (cWorldObject_Weapon *) ObjectList[ConnUser[UserParsing].Char->Equipped[EQUIPPED_WEAPON]];
  1600. }
  1601. }
  1602. }
  1603. break;
  1604. case 0x021E:
  1605. //Dunno
  1606. break;
  1607. case 0x00C8:
  1608. {
  1609. //Eval
  1610. //4th dword = GUID to eval
  1611. DWORD dwEvalGUID; memcpy(&dwEvalGUID, Packet, 4);
  1612. EvalObject(UserParsing, dwEvalGUID);
  1613. }
  1614. break;
  1615. case 0x0019:
  1616. {
  1617. //Move Item
  1618. //4th dword = GUID to move
  1619. //5th dword = GUID of item to move it into... Player for equipping, bag for putting it in.
  1620. //6th dword = Index in item to put it in
  1621. DWORD GUIDMove;
  1622. memcpy(&GUIDMove, Packet,4);
  1623. //F7B0/22
  1624. DWORD MoveItemArr[] = {
  1625. 0x0000F7B0,
  1626. ConnUser[UserParsing].Char->GUID,
  1627. ConnUser[UserParsing].EventCount,
  1628. 0x00000022,
  1629. 0,
  1630. 0,
  1631. 0
  1632. };
  1633. memcpy(&MoveItemArr[4],Packet,3*4);
  1634. ConnUser[UserParsing].EventCount++;
  1635. Send200((BYTE *) MoveItemArr, sizeof(MoveItemArr), 4, UserParsing);
  1636. cWorldObject *tpo = ObjectList[GUIDMove];
  1637. if (!tpo->Owner)
  1638. {
  1639. DWORD MoveItemCont[] = {
  1640. 0x0000F74A,
  1641. GUIDMove
  1642. };
  1643. Send200((BYTE *) MoveItemCont, 8, 4, UserParsing);
  1644. }
  1645. tpo->Owner = MoveItemArr[5];
  1646. if (GUIDMove == ConnUser[UserParsing].Char->Equipped[EQUIPPED_WEAPON])
  1647. {
  1648. //First 22D
  1649. BYTE Pack22D[0x15]; ZeroMemory(Pack22D, 0x15);
  1650. DWORD tpdword; BYTE tpbyte;
  1651. tpdword = 0x22D; memcpy(&Pack22D[0], &tpdword, 4); //22D = set wielder/container
  1652. tpbyte = ConnUser[UserParsing].EquipCount; memcpy(&Pack22D[4], &tpbyte, 1); //EquipCount
  1653. //byte here...
  1654. memcpy(&Pack22D[5], &GUIDMove, 4); //Item
  1655. tpdword = 3; memcpy(&Pack22D[9], &tpdword, 4); //Set Wielder
  1656. tpdword = 0; memcpy(&Pack22D[13], &tpdword, 4); //Wielder = 0
  1657. tpdword = ConnUser[UserParsing].EquipCount + 1; memcpy(&Pack22D[17], &tpdword, 4); //unknown2...
  1658. Send200(Pack22D, sizeof(Pack22D), 4, UserParsing);
  1659. //229
  1660. BYTE Pack229[0x11]; ZeroMemory(Pack229, 0x11);
  1661. tpdword = 0x229; memcpy(&Pack229[0], &tpdword, 4); //229 = set somin
  1662. tpbyte = ConnUser[UserParsing].EquipCount; memcpy(&Pack229[4], &tpbyte, 1); //EquipCount
  1663. //byte here...
  1664. memcpy(&Pack229[5], &GUIDMove, 4); //Item
  1665. tpdword = 0xA; memcpy(&Pack229[9], &tpdword, 4); //Unknown, always A...
  1666. tpdword = 0; memcpy(&Pack229[13], &tpdword, 4); //Coverage = 0
  1667. Send200(Pack229, sizeof(Pack229), 4, UserParsing);
  1668. //Second 22D
  1669. ZeroMemory(Pack22D, 0x15);
  1670. tpdword = 0x22D; memcpy(&Pack22D[0], &tpdword, 4); //22D = set wielder/container
  1671. tpbyte = ConnUser[UserParsing].EquipCount; memcpy(&Pack22D[4], &tpbyte, 1); //EquipCount
  1672. //byte here...
  1673. memcpy(&Pack22D[5], &GUIDMove, 4); //Item
  1674. tpdword = 2; memcpy(&Pack22D[9], &tpdword, 4); //Set Container
  1675. memcpy(&Pack22D[13], Packet + 4, 4); //Container = Bag
  1676. tpdword = 0x34500; memcpy(&Pack22D[17], &tpdword, 4); //unknown2...
  1677. Send200(Pack22D, sizeof(Pack22D), 4, UserParsing);
  1678. //EQ++
  1679. ConnUser[UserParsing].EquipCount ++;
  1680. } else {
  1681. BYTE Pack22D[0x15]; ZeroMemory(Pack22D, 0x15);
  1682. DWORD tpdword; BYTE tpbyte;
  1683. tpdword = 0x22D; memcpy(&Pack22D[0], &tpdword, 4); //22D = set wielder/container
  1684. tpbyte = ConnUser[UserParsing].MoveItemCount; memcpy(&Pack22D[4], &tpbyte, 1); //MoveItemCount
  1685. //byte here...
  1686. memcpy(&Pack22D[5], &GUIDMove, 4); //Item
  1687. tpdword = 2; memcpy(&Pack22D[9], &tpdword, 4); //2 = Set Container
  1688. memcpy(&Pack22D[13], Packet + 4, 4); //Container (pack)
  1689. tpdword = 0x34500; memcpy(&Pack22D[17], &tpdword, 4); //unknown2
  1690. Send200(Pack22D, sizeof(Pack22D), 4, UserParsing);
  1691. ConnUser[UserParsing].MoveItemCount += 2;
  1692. }
  1693. }
  1694. break;
  1695. case 0x001A:
  1696. {
  1697. //Item Worn
  1698. //4th dword = GUID of item
  1699. //5th dword = coverage
  1700. //We'll just go with equipped items now, m'kay? m'kay.
  1701. DWORD GUIDEquip, Coverage;
  1702. memcpy(&GUIDEquip, Packet, 4);
  1703. memcpy(&Coverage, Packet + 4, 4); //Ignore coverage for now m'kay? m'kay.
  1704. //F7B0/23
  1705. DWORD F7B023[] = {
  1706. 0x0000F7B0,
  1707. ConnUser[UserParsing].Char->GUID,
  1708. ConnUser[UserParsing].EventCount,
  1709. 0x00000023,
  1710. GUIDEquip,
  1711. Coverage
  1712. };
  1713. ConnUser[UserParsing].EventCount++;
  1714. Send200((BYTE *) &F7B023[0], sizeof(F7B023), 4, UserParsing);
  1715. //First 22D
  1716. BYTE Pack22D[0x15]; ZeroMemory(Pack22D, 0x15);
  1717. DWORD tpdword; BYTE tpbyte;
  1718. tpdword = 0x22D; memcpy(&Pack22D[0], &tpdword, 4); //22D = set wielder/container
  1719. tpbyte = ConnUser[UserParsing].EquipCount; memcpy(&Pack22D[4], &tpbyte, 1); //EquipCount
  1720. //byte here...
  1721. memcpy(&Pack22D[5], &GUIDEquip, 4); //Item
  1722. tpdword = 3; memcpy(&Pack22D[9], &tpdword, 4); //Set Wielder
  1723. memcpy(&Pack22D[13], &ConnUser[UserParsing].Char->GUID, 4); //Wielder = Player
  1724. tpdword = ConnUser[UserParsing].EquipCount + 1; memcpy(&Pack22D[17], &tpdword, 4); //EquipCount + 1
  1725. Send200(Pack22D, sizeof(Pack22D), 4, UserParsing);
  1726. //Second 22D
  1727. ZeroMemory(Pack22D, 0x15);
  1728. tpdword = 0x22D; memcpy(&Pack22D[0], &tpdword, 4); //22D = set wielder/container
  1729. tpbyte = ConnUser[UserParsing].EquipCount; memcpy(&Pack22D[4], &tpbyte, 1); //EquipCount
  1730. //byte here...
  1731. memcpy(&Pack22D[5], &GUIDEquip, 4); //Item
  1732. tpdword = 2; memcpy(&Pack22D[9], &tpdword, 4); //Set Container
  1733. tpdword = 0; memcpy(&Pack22D[13], &tpdword, 4); //Container = 0
  1734. tpdword = ConnUser[UserParsing].EquipCount + 1; memcpy(&Pack22D[17], &tpdword, 4); //EquipCount + 1
  1735. Send200(Pack22D, sizeof(Pack22D), 4, UserParsing);
  1736. //229
  1737. BYTE Pack229[0x11]; ZeroMemory(Pack229, 0x11);
  1738. tpdword = 0x229; memcpy(&Pack229[0], &tpdword, 4); //22D = set wielder/container
  1739. tpbyte = ConnUser[UserParsing].EquipCount; memcpy(&Pack229[4], &tpbyte, 1); //EquipCount
  1740. //byte here...
  1741. memcpy(&Pack229[5], &GUIDEquip, 4); //Item
  1742. tpdword = 0xA; memcpy(&Pack229[9], &tpdword, 4); //Unknown, always A...
  1743. memcpy(&Pack229[13], &Coverage, 4); //Coverage = 0
  1744. Send200(Pack229, sizeof(Pack229), 4, UserParsing);
  1745. //F749
  1746. DWORD F749[] = {
  1747. ConnUser[UserParsing].Char->GUID, //Wielder
  1748. GUIDEquip, //Item
  1749. 1, //Unk1
  1750. 1, //Unk2
  1751. //40254, //Unk3
  1752. 0x00254 | (0x40000 + 0x30000*((ConnUser[UserParsing].EquipCount - 1) / 2)), //Unk3, try this...
  1753. 0x80000000 //Unk4
  1754. };
  1755. Send200((BYTE *) &F749[0], sizeof(F749), 4, UserParsing);
  1756. //EQ++
  1757. ConnUser[UserParsing].EquipCount ++;
  1758. ConnUser[UserParsing].Char->Equipped[EQUIPPED_WEAPON] = GUIDEquip;
  1759. }
  1760. break;
  1761. case 0x001B:
  1762. //Item Dropped on Ground
  1763. //4th dword = GUID dropped
  1764. //?
  1765. break;
  1766. case 0x0263:
  1767. //Item Selected
  1768. //4th dword = GUID selected
  1769. memcpy(&ConnUser[UserParsing].SelectedItem, Packet,4);
  1770. break;
  1771. case 0x01bf:
  1772. //Item Selected
  1773. //4th dword = GUID selected
  1774. memcpy(&ConnUser[UserParsing].SelectedItem, Packet,4);
  1775. break;
  1776. case 0x01B7:
  1777. //Beginning of Jump
  1778. break;
  1779. case 0xF61B:
  1780. //Player Jumped
  1781. break;
  1782. case 0x00CA:
  1783. //Dunno
  1784. break;
  1785. case 0x01A1:
  1786. //Dunno
  1787. break;
  1788. default:
  1789. {
  1790. char *tps2, *tps3 = new char[1 + PacketLen*5];
  1791. ZeroMemory(tps3,1 + PacketLen*5);
  1792. tps2 = tps3;
  1793. for (unsigned int tpl=0; tpl < PacketLen; tpl++)
  1794. {
  1795. sprintf(tps2, "0x%02X ", Packet[tpl]);
  1796. tps2+=5;
  1797. }
  1798. sprintf(sayit, "F7B1/%04X Pack Data: %s", MessageType, tps3); LogDisp(sayit);
  1799. delete [] tps3;
  1800. break;
  1801. }
  1802. }
  1803. }