//fireworks void console_fireworks(char *args[], int numArgs, bool adminConsole, short NetworkID) { Player* p = instances[0].AccessPlayer(NetworkID); /* Cheap Fireworks pck.Add(p->AASetGenericValue(0x11, 0x511, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x512, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x4e, NetworkID));*/ CompiledPacket pck; NetMessage s; s.ID=NetworkID; int waittime = 0; pck.Add(p->AASetGenericValue(0x11, 0x50f, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x50e, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x517, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x513, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x511, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x510, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50c, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x50d, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x515, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x516, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50f, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x515, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x510, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50c, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50e, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x510, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x511, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x510, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x514, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x517, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x513, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x50d, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x50d, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50c, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50d, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50c, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x50e, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x512, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x510, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x517, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x510, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x512, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50e, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x513, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50d, NetworkID)); pck.Add(p->AASetGenericValue(0x11, 0x517, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x512, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); pck.Add(p->AASetGenericValue(0x11, 0x50c, NetworkID)); s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s, (waittime++)*1000); } #include "Instance.h" #include "Main.h" #include "AgentPackets.h" void CommandProcessing(char *commandString, bool adminConsole, void *lir, Player *p); void Instance::WriteGeneralChat(unsigned char *buffer, long numUniChars, char color, unsigned long LocalID, short NetworkID) { long playerSlot=instances[0]->FindPlayerByNID(NetworkID); Player *p=&(instances[0]->players[playerSlot]); if(buffer==NULL){return;} CompiledPacket pck(true); //Add the message packet pck.AddShort(PckHeaders.GENERAL_CHAT); pck.AddShort(numUniChars+3); pck.AddLong(0x01070108); pck.Add(buffer,numUniChars*2,false); pck.AddShort(0x0001); if(p->control==-1) { //Add the message owner packet pck.AddShort(PckHeaders.GENERAL_CHAT_OWNER); pck.AddShort(LocalID); pck.AddByte(color); } else if(p->control==1) { //Add the message owner packet pck.AddShort(0x0050); pck.AddShort(0x0000); pck.AddByte(0x08); } else if(p->control==2) { //Add the message owner packet pck.AddShort(0x0050); pck.AddShort(0x0000); pck.AddByte(0x02); } NetMessage s; s.ID=NetworkID; s.data=pck.GetString(&s.dataSize); GameServer->SendData(&s); } int Instance::ProcessGuildChat(int ID, unsigned char *d) { return 0; } int Instance::ProcessCommand(unsigned char *dest,NetMessage *d, NetMessage *s, void* lir) { /* dash effect and icon pck.AddShort(0x00cd); pck.AddLong(p->GetAgentID()); pck.AddShort(0x0413); pck.AddLong(0x0); pck.AddShort(0x008f); pck.AddLong(0x39); pck.AddLong(p->GetAgentID()); pck.AddLong(0xbe1b26ca); pck.AddShort(0x00ce); pck.AddLong(p->GetAgentID()); pck.AddShort(0x0413); pck.AddLong(0x0); pck.AddLong(0x8); pck.AddShort(0x008c); pck.AddLong(0x2b); pck.AddLong(p->GetAgentID()); pck.AddShort(0x0413); pck.AddShort(0x0); pck.AddShort(0x008c); pck.AddLong(0x12); pck.AddLong(p->GetAgentID()); pck.AddShort(0x0498); pck.AddShort(0x0); pck.AddShort(0x0036); pck.AddLong(p->GetAgentID()); pck.AddLong(0xc); pck.AddShort(0x0034); pck.AddLong(p->GetAgentID()); pck.AddShort(0x0413); pck.AddLong(0x0); pck.AddLong(0xc); pck.AddLong(0x40400000); pck.AddShort(0x00cc); pck.AddLong(p->GetAgentID()); pck.AddShort(0x0413); pck.AddLong(0x0); pck.AddShort(0x0011); pck.AddLong(0x5e);*/ long playerSlot=FindPlayerByNID(((LOGIN_INFO*)lir)->NetworkID); Player *p=&players[playerSlot]; char* cmd = new char[d->dataSize-6]; memset(cmd, 0, d->dataSize-6); for(int t = 0, i = 6; i<((d->dataSize-6)*2+6); t++, i+=2) cmd[t] = dest[i]; cmd[d->dataSize-7] = 0; printf("%s", cmd); if(strstr(cmd,".gm")==&cmd[0]) { p->Stats.vitalStatus ^= 0x00000200; p->Send_UpdateVitalStatus(((LOGIN_INFO*)lir)->NetworkID); if(p->chatcolor==5) p->chatcolor = 3; else p->chatcolor = 5; } if(strstr(cmd,".toggle frog")==&cmd[0]) { if(p->control==-1) p->control = 1; else p->control = -1; } if(strstr(cmd,".toggle broadcast")==&cmd[0]) { if(p->control==-1) p->control = 2; else p->control = -1; } else if(strstr(cmd,".earthquake")==&cmd[0]) { CompiledPacket pck; short header=PckHeaders.UPDATE_GENERIC_VALUE; pck.AddShort(header); pck.AddLong(0x00000008); pck.AddLong(p->target); char str = cmd[11]; pck.AddLong(atol(&str)); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".speed")==&cmd[0]) { CompiledPacket pck; pck.AddShort(0x001a); pck.AddLong(p->GetAgentID()); char level[4]; level[0] = 0; level[1] = 0; level[2] = 0; level[3] = 0; int len = 4; if(!(48<=cmd[8])&&(cmd[8]<=57)) len = 1; if(!(48<=cmd[9])&&(cmd[9]<=57)) len = 2; if(!(48<=cmd[10])&&(cmd[10]<=57)) len = 3; if(!(48<=cmd[11])&&(cmd[11]<=57)) len = 4; memcpy(&level[0], &cmd[7], len); long speed = atol(level); float realspeed = speed * 288.0f; p->Stats.currentSpeed = realspeed; pck.AddFloat(realspeed); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".preparecupcakes")==&cmd[0]) { Item item; if(!ItemDefMan.CreateItem("BirthdayCupcake",&item)) { CoreLog.LOCATION; CoreLog.error("Failed to create Cupcake!"); } vector::iterator cycleItr; for(cycleItr=players.begin(); cycleItr!=players.end(); cycleItr++) { if(!cycleItr->isGhost) { for(int i=0; i<20; i++) { item.GenerateID(cycleItr->GetAccountID(),cycleItr->GetCharacterID(),NULL); item.SetItemStorageLocation(LOC_IN_BACKPACK); item.SetItemStoragePosition(i); item.Save(); } } } } else if(strstr(cmd,".drop")==&cmd[0]) { int itemslot = 0x07; //First inventory slot = 0x07 int i = 0; cupcake: //Initialise packet. CompiledPacket pck; //Get a new agent id for the drop. int agentid = AgentIDMan.GetFreeID(); //Get random position around the player. float x, y; x = rand()%2?p->GetCurrentPos().x+rand()%5000:p->GetCurrentPos().x-rand()%5000; y = rand()%2?p->GetCurrentPos().y+rand()%5000:p->GetCurrentPos().y-rand()%5000; //Add to cupcake vector. CUPCAKE Cupcake; Cupcake.AgentID = agentid; Cupcake.x = x; Cupcake.y = y; (*(*instances.begin())->GetCupcakeVector()).push_back(Cupcake); //Spawn drop. pck.AddShort(0x0013); pck.AddLong(agentid); pck.AddLong(itemslot); pck.AddShort(0x0004); pck.AddFloat(x); pck.AddFloat(y); pck.AddShort(0x0000); pck.AddFloat(1); pck.AddFloat(0); //Rotation pck.AddShort(0x0001); pck.AddByte(0x0000); pck.AddShort(0); pck.AddFloat(1); pck.AddShort(0x0000); pck.AddShort(0x3400); pck.AddShort (0); pck.AddShort(0); pck.Fill(0x00, 0x1c); pck.AddFloat(1); pck.AddFloat(1); pck.Fill(0x00, 0x06); pck.AddFloat(1); pck.AddFloat(1); pck.AddShort(0x0000); time_t waittime = rand(); //Send to player. NetMessage s; s.data=pck.GetString(&s.dataSize); s.ID=p->GetNetworkID(); GameServer->SendData(&s, waittime); //Update all other players in the instance of this drop. PLAYER_CYCLE_START(p) s.ID=cycleItr->GetNetworkID(); GameServer->SendData(&s, waittime); PLAYER_CYCLE_END() pck.Clear(); if(i<=1000) { i++; goto cupcake; } } else if(strstr(cmd,".size")==&cmd[0]) { CompiledPacket pck; pck.AddShort(0x0087 ); pck.AddLong(p->target); pck.AddShort(0x0000); pck.AddByte(0x00); pck.AddByte(cmd[9]); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".kill")==&cmd[0]) { AgentPackets::SetVitalStatus(p->target, 0x00000010, (((LOGIN_INFO*)lir)->NetworkID)); } else if(strstr(cmd,".res")==&cmd[0]) { AgentPackets::SetVitalStatus(p->target, 0x00000000, (((LOGIN_INFO*)lir)->NetworkID)); AgentPackets::SetGenericValue(0x00000025, p->target, p->Stats.maxHP, p->GetNetworkID()); AgentPackets::SetGenericValue(0x00000024, p->target, p->Stats.maxEnergy, p->GetNetworkID()); } else if(strstr(cmd,".rank")==&cmd[0]) { long emote = 0x0000000C; AgentPackets::SetGenericValue(0x00000016, p->target, emote, ((LOGIN_INFO*)lir)->NetworkID); AgentPackets::SetGenericValue(0x00000013, p->target, 0x363540B9, ((LOGIN_INFO*)lir)->NetworkID); } else if(strstr(cmd,".knockdown")==&cmd[0]) { AgentPackets::SetGenericValue(0x0000001E, p->target, cmd[11], ((LOGIN_INFO*)lir)->NetworkID); } else if(strstr(cmd,".addquest")==&cmd[0]) { AgentPackets::SetGenericValue(0x0000000A, p->target, 0, ((LOGIN_INFO*)lir)->NetworkID); } else if(strstr(cmd,".removequest")==&cmd[0]) { AgentPackets::SetGenericValue(0x0000000B, p->target, 0, ((LOGIN_INFO*)lir)->NetworkID); } else if(strstr(cmd,".stance")==&cmd[0]) { AgentPackets::SetGenericValue(0x00000021, p->target, 0, ((LOGIN_INFO*)lir)->NetworkID); } else if(strstr(cmd,".targetself")==&cmd[0]) { p->target = p->GetAgentID(); } else if(strstr(cmd,".targetminipet")==&cmd[0]) { p->target = p->minipet; } else if(strstr(cmd,".come")==&cmd[0]) { CompiledPacket mini; mini.AddShort(PckHeaders.GOTO_LOCATION); mini.AddLong(p->target); mini.AddFloat(p->GetCurrentPos().x); mini.AddFloat(p->GetCurrentPos().y); mini.AddFloat(p->GetCurrentPos().z); NetMessage s; s.ID=p->GetNetworkID(); s.data=mini.GetString(&s.dataSize); GameServer->SendData(&s); } else if(strstr(cmd,".cast")==&cmd[0]) { CompiledPacket pck; short header=PckHeaders.UPDATE_GENERIC_VALUE; pck.AddShort(header); pck.AddLong(0x00000037); pck.AddLong(p->target); char level[4]; level[0] = 0; level[1] = 0; level[2] = 0; level[3] = 0; int len = 4; if(!(48<=cmd[7])&&(cmd[7]<=57)) len = 1; if(!(48<=cmd[8])&&(cmd[8]<=57)) len = 2; if(!(48<=cmd[9])&&(cmd[9]<=57)) len = 3; if(!(48<=cmd[10])&&(cmd[10]<=57)) len = 4; memcpy(&level[0], &cmd[6], len); pck.AddLong(atol(level)); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".glow")==&cmd[0]) { CompiledPacket pck; short header=PckHeaders.UPDATE_GENERIC_VALUE; pck.AddShort(header); pck.AddLong(0x00000018); pck.AddLong(p->target); srand(time(NULL)); pck.AddLong(rand() % 10 + 1); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".pick")==&cmd[0]) { CompiledPacket pck; short header=PckHeaders.UPDATE_GENERIC_VALUE; pck.AddShort(header); pck.AddLong(0x00000022); pck.AddLong(p->GetAgentID()); pck.AddLong(1); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".value")==&cmd[0]) { char *model1 = new char[9]; memset(model1, 0, 8); model1[8] = ' '; char *pEnd1; pEnd1 = model1+7; for(int i = 0; i<8; i++) model1[i] = cmd[i+7]; long lModel1 = Util::HexToDecimal(model1); printf("\n%X\n", lModel1); for(int i = 0; i<8; i++) model1[i] = cmd[i+16]; long lModel2 = Util::HexToDecimal(model1); printf("%X\n", lModel2); AgentPackets::SetGenericValue(lModel1, p->target, lModel2, ((LOGIN_INFO*)lir)->NetworkID); } else if(strstr(cmd,".setlevel")==&cmd[0]) { CompiledPacket pck; short header=PckHeaders.UPDATE_GENERIC_VALUE; pck.AddShort(header); pck.AddLong(0x00000020); pck.AddLong(p->target); char level[3]; level[0] = 0; level[1] = 0; level[2] = 0; int len; if(!(48<=cmd[11])&&(cmd[11]<=57)) len = 1; if(!(48<=cmd[12])&&(cmd[12]<=57)) len = 2; if(!(48<=cmd[13])&&(cmd[13]<=57)) len = 3; memcpy(&level[0], &cmd[10], len); pck.AddLong(atol(level)); printf("%d",atol(level)); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".morph")==&cmd[0]) { char *model1 = new char[9]; memset(model1, 0, 8); model1[8] = ' '; char *pEnd1; pEnd1 = model1+7; for(int i = 0; i<8; i++) model1[i] = cmd[i+7]; long lModel1 = Util::HexToDecimal(model1); printf("\n%X\n", lModel1); for(int i = 0; i<8; i++) model1[i] = cmd[i+16]; long lModel2 = Util::HexToDecimal(model1); printf("%X\n", lModel2); CompiledPacket pck; short header=0x0048; Util::ReverseShortByteOrder(&header); unsigned long npcid = Instance::LocalIDMan.GetFreeID(); //change model (spawn an npc) pck.AddShort(0x0048); // const pck.AddLong(npcid); // const pck.AddLong(lModel1); //elf model 1 pck.Fill(0x00, 0x06); pck.AddShort(0x6400); //size pck.AddLong(0x00000000); // const pck.AddLong(0x0000000c); // const pck.AddShort(0x000b); // const pck.AddShort(0x0002); // const pck.AddShort(0x8101); // const pck.AddShort(0x5E63); if(lModel2!=0) { pck.AddShort(0x0049); pck.AddLong(npcid); pck.AddShort(0x0001); // const pck.AddLong(lModel2); // elf model 2 } //change model (turn you into the npc) pck.AddShort(0x009b); // const pck.AddLong(p->target); pck.AddLong(npcid); // const*/ pck.AddShort(0x008c); pck.AddLong(0x00000007); pck.AddLong(p->target); pck.AddLong(0x00000000); Instance::LocalIDMan.FreeID(npcid); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".frog")==&cmd[0]) { CompiledPacket pck; pck.AddShort(0x004f); //Header pck.AddShort(0x001c); pck.AddShort(0x0108); pck.AddShort(0x0107); pck.AddShort(0x0049); pck.AddShort(0x006e); pck.AddShort(0x0064); pck.AddShort(0x0065); pck.AddShort(0x0065); pck.AddShort(0x0064); pck.AddShort(0x002c); pck.AddShort(0x0020); pck.AddShort(0x0054); pck.AddShort(0x0068); pck.AddShort(0x0065); pck.AddShort(0x0020); pck.AddShort(0x0046); pck.AddShort(0x0072); pck.AddShort(0x006f); pck.AddShort(0x0067); pck.AddShort(0x0020); pck.AddShort(0x0069); pck.AddShort(0x0073); pck.AddShort(0x0020); pck.AddShort(0x0068); pck.AddShort(0x0065); pck.AddShort(0x0072); pck.AddShort(0x0065); pck.AddShort(0x002e); pck.AddShort(0x0001); //no_owner_packet pck.AddShort(0x0050); //header pck.AddShort(0x0000); //no_owner? :P pck.AddByte(0x0d); //color if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} /*000001ec:4f 00 1c 00 08 01 07 01 49 00 6e 00 64 00 65 00 O.......I.n.d.e. 000001fc:65 00 64 00 2c 00 20 00 54 00 68 00 65 00 20 00 e.d.,. .T.h.e. . 0000020c:46 00 72 00 6f 00 67 00 20 00 69 00 73 00 20 00 F.r.o.g. .i.s. . 0000021c:68 00 65 00 72 00 65 00 2e 00 01 00 50 00 00 00 h.e.r.e.....P... 0000022c:08 11 00 2f 00 00 00 18 00 59 01 00 00 72 01 6f .../.....Y...r.o 0000023c:3f 00 db b6 3e 01 1c 00 59 01 00 00 74 c2 bb 45 ?.Û¶>...Y...t»E 0000024c:ee 8a f7 45 23 00 23 00 11 00 10 00 00 00 îŠ÷E#.#....... */ } else if(strstr(cmd,"dance")==&cmd[0]) { CompiledPacket pck; pck.AddShort(0x004f); //Header pck.AddShort(0x0003); //unknown pck.AddShort(0x079d); //text reference for dance text pck.AddByte(0x0d); //? pck.AddByte(0x01); //bitfield? pck.AddByte(0x01); //bitfield? pck.AddByte(0x01); //bitfield? pck.AddShort(0x0050); pck.AddShort(0x0001); pck.AddShort(0x8c06); pck.AddByte(0x00); pck.AddLong(0x00000014); pck.AddLong(p->GetAgentID()); pck.AddLong(0x00000004); pck.AddShort(0x008c); pck.AddLong(0x00000017); pck.AddLong(p->GetAgentID()); pck.AddLong(0x31939cbb); //dance animation reference? pck.AddShort(0x008c); pck.AddLong(0x00000007); pck.AddLong(p->GetAgentID()); pck.AddLong(0x00000001); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".dance")==&cmd[0]) { CompiledPacket pck; pck.AddShort(0x004f); //Header pck.AddShort(0x0003); //unknown pck.AddShort(0x079d); //text reference for dance text pck.AddByte(0x0d); //? pck.AddByte(0x01); //bitfield? pck.AddByte(0x01); //bitfield? pck.AddByte(0x01); //bitfield? pck.AddShort(0x0050); pck.AddShort(0x0001); pck.AddShort(0x8c06); pck.AddByte(0x00); pck.AddLong(0x00000014); pck.AddLong(p->target); pck.AddLong(0x00000004); pck.AddShort(0x008c); pck.AddLong(0x00000017); pck.AddLong(p->target); pck.AddLong(0x31939cbb); //dance animation reference? pck.AddShort(0x008c); pck.AddLong(0x00000007); pck.AddLong(p->target); pck.AddLong(0x00000001); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".spawn")==&cmd[0]) { char *model1 = new char[9]; memset(model1, 0, 8); model1[8] = ' '; char *pEnd1; pEnd1 = model1+7; for(int i = 0; i<8; i++) model1[i] = cmd[i+7]; long lModel1 = Util::HexToDecimal(model1); printf("\n%X\n", lModel1); for(int i = 0; i<8; i++) model1[i] = cmd[i+16]; long lModel2 = Util::HexToDecimal(model1); printf("%X\n", lModel2); CompiledPacket pck; unsigned long npcid = Instance::LocalIDMan.GetFreeID(); //change model (spawn an npc) pck.AddShort(0x0048); // const pck.AddLong(npcid); // const pck.AddLong(lModel1); //elf model 1 pck.Fill(0x00, 0x06); pck.AddShort(0x6400); pck.AddLong(0x00000000); // const pck.AddLong(0x0000000c); // const pck.AddShort(0x000b); // const pck.AddShort(0x0002); // const pck.AddShort(0x8101); // const pck.AddShort(0x5E63); if(lModel2!=0) { pck.AddShort(0x0049); pck.AddLong(npcid); pck.AddShort(0x0001); // const pck.AddLong(lModel2); // elf model 2 } int agentid = AgentIDMan.GetFreeID(); //position npc pck.AddShort(0x0013); pck.AddLong(agentid); pck.AddLong(npcid | 0x20000000 ); pck.AddShort( 0x0901 ); pck.AddFloat( p->GetCurrentPos().x); pck.AddFloat( p->GetCurrentPos().y ); pck.AddShort( 0x0000 ); pck.AddFloat( 1 ); pck.AddFloat( 0 /*rotaion*/ ); pck.AddShort( 0x0001 ); pck.AddByte( 0x0000 ); pck.AddShort( 0x4396 ); pck.AddFloat( 1 ); pck.AddShort( 0x0000 ); pck.AddShort( 0x4140 ); pck.AddShort (0x6e63 ); pck.AddShort( 0x6e6f ); pck.Fill( 0x00, 0x1c ); pck.AddFloat ( 1 ); pck.AddFloat ( 1 ); pck.Fill ( 0x00, 0x06 ); pck.AddFloat( 1 ); pck.AddFloat( 1 ); pck.AddShort( 0x0000 ); printf("Spawned NPC with modelID %x %x and agentID %x (%d) at X = %f and Y = %f", lModel1, lModel2, agentid, agentid, ZoneInfos[GetZoneInfo(GetZoneID())].spawnX, ZoneInfos[GetZoneInfo(GetZoneID())].spawnY); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".ghostinabox")==&cmd[0]) { long lModel1 = 0x0000cc7f; CompiledPacket pck; unsigned long npcid = Instance::LocalIDMan.GetFreeID(); //change model (spawn an npc) pck.AddShort(0x0048); // const pck.AddLong(npcid); // const pck.AddLong(lModel1); //elf model 1 pck.Fill(0x00, 0x06); pck.AddShort(0x6400); pck.AddLong(0x00000000); // const pck.AddLong(0x0000000c); // const pck.AddShort(0x000b); // const pck.AddShort(0x0002); // const pck.AddShort(0x8101); // const pck.AddShort(0x5E63); int agentid = AgentIDMan.GetFreeID(); //position npc pck.AddShort(0x0013); pck.AddLong(agentid); pck.AddLong(npcid | 0x20000000 ); pck.AddShort( 0x0901 ); pck.AddFloat( Vertex::GetPointInBox(Vertex(p->GetCurrentPos().x,p->GetCurrentPos().y),Vertex(10,10)).x); pck.AddFloat( Vertex::GetPointInBox(Vertex(p->GetCurrentPos().x,p->GetCurrentPos().y),Vertex(10,10)).y); pck.AddShort( 0x0000 ); pck.AddFloat( 1 ); pck.AddFloat( rand() /*rotaion*/ ); pck.AddShort( 0x0001 ); pck.AddByte( 0x0000 ); pck.AddShort( 0x4396 ); pck.AddFloat( 1 ); pck.AddShort( 0x0000 ); pck.AddShort( 0x4140 ); pck.AddShort (0x6e63 ); pck.AddShort( 0x6e6f ); pck.Fill( 0x00, 0x1c ); pck.AddFloat ( 1 ); pck.AddFloat ( 1 ); pck.Fill ( 0x00, 0x06 ); pck.AddFloat( 1 ); pck.AddFloat( 1 ); pck.AddShort( 0x0000 ); printf("Spawned NPC with modelID %x %x and agentID %x (%d) at X = %f and Y = %f", lModel1, 0, agentid, agentid, ZoneInfos[GetZoneInfo(GetZoneID())].spawnX, ZoneInfos[GetZoneInfo(GetZoneID())].spawnY); //Send to player. NetMessage s; s.data=pck.GetString(&s.dataSize); s.ID=p->GetNetworkID(); GameServer->SendData(&s); //Update all other players in the instance. PLAYER_CYCLE_START(p) s.ID=cycleItr->GetNetworkID(); GameServer->SendData(&s); PLAYER_CYCLE_END() pck.Clear(); pck.AddShort(0xd6); pck.AddLong(agentid); pck.AddLong(0x00000010); s.data=pck.GetString(&s.dataSize); s.ID=p->GetNetworkID(); GameServer->SendData(&s, 1000); //Update all other players in the instance. for(cycleItr=players.begin(); cycleItr!=players.end(); cycleItr++){if(cycleItr->Connected && !cycleItr->isGhost && !selPlayer->isGhost && cycleItr->GetLocalID()!=selPlayer->GetLocalID()){ s.ID=cycleItr->GetNetworkID(); GameServer->SendData(&s, 1000); PLAYER_CYCLE_END() pck.Clear(); pck.AddShort(0x14); pck.AddLong(agentid); s.data=pck.GetString(&s.dataSize); s.ID=p->GetNetworkID(); GameServer->SendData(&s, 3000); //Update all other players in the instance. for(cycleItr=players.begin(); cycleItr!=players.end(); cycleItr++){if(!cycleItr->isGhost && !selPlayer->isGhost && cycleItr->GetLocalID()!=selPlayer->GetLocalID()){ s.ID=cycleItr->GetNetworkID(); GameServer->SendData(&s, 3000); PLAYER_CYCLE_END() pck.Clear(); } else if(strstr(cmd,".minipet")==&cmd[0]) { if(p->minipet) { CompiledPacket pck; pck.AddShort(0x14); pck.AddLong(p->minipet); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } char *model1 = new char[9]; memset(model1, 0, 8); model1[8] = ' '; char *pEnd1; pEnd1 = model1+7; for(int i = 0; i<8; i++) model1[i] = cmd[i+9]; long lModel1 = Util::HexToDecimal(model1); printf("\n%X\n", lModel1); for(int i = 0; i<8; i++) model1[i] = cmd[i+18]; long lModel2 = Util::HexToDecimal(model1); printf("%X\n", lModel2); CompiledPacket pck; unsigned long npcid = Instance::LocalIDMan.GetFreeID(); //change model (spawn an npc) pck.AddShort(0x0048); // const pck.AddLong(npcid); // const pck.AddLong(lModel1); //elf model 1 pck.Fill(0x00, 0x06); pck.AddShort(0x2800); //size... 2800 for Gwen mini pck.AddLong(0x00000000); // const pck.AddLong(0x00006084); // const pck.AddShort(0x0001); // const pck.AddShort(0x0005); // const pck.AddShort(0x8101); // const pck.AddShort(0x682b); // const pck.AddShort(0xdbde); pck.AddShort(0xf8dd); pck.AddShort(0x049a); /*//change model (spawn an npc) pck.AddShort(0x0048); // const pck.AddLong(npcid); // const pck.AddLong(lModel1); //elf model 1 pck.Fill(0x00, 0x06); pck.AddShort(0x6400); pck.AddLong(0x00000000); // const pck.AddLong(0x0000000c); // const pck.AddShort(0x000b); // const pck.AddShort(0x0002); // const pck.AddShort(0x8101); // const pck.AddShort(0x5E63);*/ if(lModel2!=0) { pck.AddShort(0x0049); pck.AddLong(npcid); pck.AddShort(0x0001); // const pck.AddLong(lModel2); // elf model 2 /*pck.AddShort(0xc818); pck.AddLong(0x00870001); pck.AddLong(npcid); pck.AddLong(0x28); */ pck.AddShort(0x008c); pck.AddLong(0x001f); pck.AddLong(npcid); pck.AddLong(1); pck.AddShort(0x00d6); pck.AddLong(npcid); pck.AddLong(0); /*pck.AddShort(0x0011); pck.AddShort(0x5e); pck.AddByte(0);*/ } int agentid = AgentIDMan.GetFreeID(); //position npc pck.AddShort(0x0013); pck.AddLong(agentid); pck.AddLong(npcid | 0x20000000 ); pck.AddShort( 0x0901 ); pck.AddFloat( p->GetCurrentPos().x); pck.AddFloat( p->GetCurrentPos().y ); pck.AddShort( 0x0000 ); pck.AddFloat( 1 ); pck.AddFloat( 0 /*rotaion*/ ); pck.AddByte(1); pck.AddFloat(288);//speed pck.AddFloat( 1 ); pck.AddShort( 0x0000 ); pck.AddShort( 0x4140 ); pck.AddShort (0x6e63 ); pck.AddShort( 0x6e6f ); pck.Fill( 0x00, 0x1c ); pck.AddFloat( 1 ); pck.AddFloat( 1 ); pck.Fill( 0x00, 0x06 ); pck.AddFloat( 1 ); pck.AddFloat( 1 ); pck.AddShort( 0x0000 ); //set minipet :) pck.AddShort(0x005f); pck.AddLong(agentid); pck.AddLong(0); pck.AddLong(0); pck.AddShort(0x008f); pck.AddLong(0x00000027); pck.AddLong(agentid); pck.AddShort(0xcccd); pck.AddShort(0x3e4c); pck.AddShort(0x0019); pck.AddLong(agentid); pck.AddByte(0x08); pck.AddShort(0x0011); pck.AddLong(0x0000009c); p->minipet = agentid; printf("Spawned NPC with modelID %x %x and agentID %x (%d) at X = %f and Y = %f", lModel1, lModel2, agentid, agentid, ZoneInfos[GetZoneInfo(GetZoneID())].spawnX, ZoneInfos[GetZoneInfo(GetZoneID())].spawnY); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } else if(strstr(cmd,".del")==&cmd[0]) { CompiledPacket pck; pck.AddShort(0x14); pck.AddLong(p->target); if(((LOGIN_INFO*)lir)->NetworkID==0){pck.GetMiniPck();}else{Util::SendCompiledPacket(&pck,((LOGIN_INFO*)lir)->NetworkID,GameServer);} } //ConsoleWrite("You used a test command", false, p->GetNetworkID(), p->GetLocalID(), 13); return d->dataSize; } int Instance::ProcessTeamChat(unsigned char *dest,NetMessage *d, NetMessage *s, void* lir) { return 4+(dest[2]*2); } int Instance::ProcessLocalChat(unsigned char *dest,NetMessage *d, NetMessage *s, void* lir) { long playerSlot=FindPlayerByNID(((LOGIN_INFO*)lir)->NetworkID); Player *p=&players[playerSlot]; char messageU[250]; memset(messageU,0,250); memcpy( messageU, &dest[0x06], ((*((unsigned short*)&dest[0x02])) - 1) * 2 ); vector::iterator itr; for(itr=players.begin(); itr!=players.end(); itr++) { WriteGeneralChat((unsigned char*)messageU,((*((unsigned short*)&dest[0x02])) - 1),p->chatcolor,p->GetLocalID(),itr->GetNetworkID()); } return 4+(dest[2]*2); } int Instance::ProcessTradeChat(unsigned char *dest,NetMessage *d, NetMessage *s, void* lir) { long playerSlot=FindPlayerByNID(((LOGIN_INFO*)lir)->NetworkID); Player *p=&players[playerSlot]; char messageU[250]; memset(messageU,0,250); memcpy( messageU, &dest[0x06], ((*((unsigned short*)&dest[0x02])) - 1) * 2 ); vector::iterator itr; for(itr=players.begin(); itr!=players.end(); itr++) { WriteGeneralChat((unsigned char*)messageU,((*((unsigned short*)&dest[0x02])) - 1),12,p->GetLocalID(),itr->GetNetworkID()); } return 4+(dest[2]*2); } int Instance::ProcessWhisperChat(unsigned char *dest,NetMessage *d, NetMessage *s, void* lir) { return 0; }