#include "Main.h" //Uncomment the line below to check the GUI toggles size //If you get an error 7. GUI toggles is correct. //#define TEST_GUI_TOGGLES_SIZE unsigned long GetSISA(int ref, Player* pPlayer, Instance* pInstance) { Item* pItem=pPlayer->GetEquippedItem(ref); if (pItem!=NULL) { long ISA=pItem->GetExternalIsa(); return ISA; } else { return 0; } } MiniCompPck Instance::SpawnPlayer(Player* pFromPlayer, unsigned short networkId) { CompiledPacket pck; //add the spawn packets pck.Add( pFromPlayer->Send_SetPlayerAppearance(NULL) ); pck.Add( pFromPlayer->Send_SetMyMiscCape(NULL) ); PLAYER_DATA* pLir=pFromPlayer->GetLir(); Agent* pAgent=pFromPlayer->GetAgent(); //Add this player's currently equipped items for (unsigned int i=EQUIPPED_WEAPON; i<=EQUIPPED_ARMOR_FEET; i++) { Item* pItem=pFromPlayer->GetEquippedItem(i); if (pItem!=NULL) { pck.Add(pFromPlayer->GetAgent()->AAAgentItem(pItem->GetExternalIsa(), pItem, NULL)); } } pck.Add(pFromPlayer->GetAgent()->AASetEquippedItems ( GetSISA(EQUIPPED_WEAPON, pFromPlayer, this), GetSISA(EQUIPPED_OFFHAND, pFromPlayer, this), GetSISA(EQUIPPED_ARMOR_CHEST, pFromPlayer, this), GetSISA(EQUIPPED_ARMOR_FEET, pFromPlayer, this), GetSISA(EQUIPPED_ARMOR_LEGS, pFromPlayer, this), GetSISA(EQUIPPED_ARMOR_ARMS, pFromPlayer, this), GetSISA(EQUIPPED_ARMOR_HEAD, pFromPlayer, this), NULL ));//*/ //Add the morale packet pck.Add(pAgent->AASetMorale(NULL)); //Add the public profession packet pck.Add(pAgent->AASetPublicProfession(NULL)); //Add the vital status packet pck.Add(pAgent->AASetVitalStatus(NULL)); //Add the level packet pAgent->SetLevel(pAgent->GetLevel()); FinishPacket(); } bool Instance::InitZoneStream(void* pLir2) { //Set some of our startup stuff PLAYER_DATA* pLir=(PLAYER_DATA*)pLir2; Player* pPlayer = AccessPlayer(((PLAYER_DATA*)pLir2)->networkId); Agent* pAgent=pPlayer->GetAgent(); //Create our instance of compiledPacket CompiledPacket pck; //Add the start of this stream packet pck.AddShort(ServerOpcode(20)); pck.AddShort(0x40); unsigned char hexData[269] = { 0x06, 0x44, 0x42, 0xD6, 0x56, 0x09, 0x44, 0x22, 0x38, 0x9B, 0x3D, 0x00, 0x40, 0x27, 0x40, 0x01, 0x90, 0x84, 0x00, 0x23, 0x75, 0xF0, 0x93, 0x01, 0x25, 0x63, 0x6B, 0x52, 0x2E, 0x5C, 0xFF, 0xDF, 0xE7, 0x9D, 0x6F, 0xDF, 0x7F, 0x7B, 0xFF, 0x3A, 0x26, 0x8C, 0x9B, 0xBF, 0x10, 0xEA, 0x48, 0xF0, 0xDB, 0xFF, 0xFD, 0x9B, 0xC0, 0xFF, 0xFF, 0xD9, 0xFF, 0xFF, 0xFB, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x91, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x20, 0x40, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x21, 0x04, 0x41, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, 0x48, 0x00, 0xB0, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x03, 0x10, 0x00, 0x00, 0x0C, 0x00, 0x40, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x48, 0x08, 0x00, 0x80, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, //0x0B, 0x00, 0x01, 0x00, 0xFE, 0x5F, 0x0C, 0x0D, //8 byte packet //0x0D, 0x00, 0x01, 0x00, 0x03 //another packet? }; //This should be changed later pck.Add(hexData, 264-8, false);//231, 228, //Add the GUI Toggles packet //pck.Add(Send_GUIToggles(NULL)); #ifdef TEST_GUI_TOGGLES_SIZE pck.AddShort(0); #else //TEMP //Add the BEGIN_MY_CHARACTER_INFO packet pck.AddShort(ServerOpcode(22)); pck.Add("yalp"); //TEMP //Add the player's free attribute points packet pck.Add(pPlayer->Send_SetFreeAtrribPoints(NULL)); //Add the private profession packet pck.Add(pPlayer->Send_SetPrivateProfession(NULL)); //Send the Skill bar pck.Add(pAgent->APSetSkillBar(NULL)); //Add the map data pck.Add(this->MakeMapPacket(NULL)); //Update the players private stats pck.Add(pPlayer->Send_UpdateMyPrivateStats(NULL)); //Get the player's appearance pck.Add(pPlayer->Send_SetPlayerAppearance(NULL)); //Send the current morale //#Has issues with automatic updating pck.Add(pAgent->AASetMorale(NULL)); //Get the player's public profession pck.Add(pAgent->AASetPublicProfession(NULL)); //Get the player's vital status pck.Add(pPlayer->GetAgent()->AASetVitalStatus(NULL)); //TEMP pck.AddShort(0x002d); pck.AddLong(pAgent->GetAgentId()); unsigned char hexData2[38] = { 0x09, 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00 }; pck.Add(hexData2, 38, false); //Get the player's misc cape pck.Add(pPlayer->Send_SetMyMiscCape(NULL)); //Get the player's equipped items //NOTE: May have problems being auto-updated. pck.Add(pPlayer->Send_SetMyEquippedItems(NULL)); //Set the player to connected status now. If we don't it is possible to have two players who joined at the same time to not see each other. pPlayer->SetFlag(PLAYER_IS_CONNECTED, true); //Spawn current players for this new player PLAYER_GHOST_CYCLE_START() if (curPlayer!=pPlayer) { pck.Add(SpawnPlayer(curPlayer, NULL)); } PLAYER_GHOST_CYCLE_END(); //Send this new player to the current players PLAYER_CYCLE_START() if (curPlayer!=pPlayer) { SpawnPlayer(pPlayer, curPlayer->GetnetworkId()); } PLAYER_CYCLE_END(); //Send the available skills pck.Add(pPlayer->Send_MyAvailableSkills(NULL)); //Fade into the map pck.AddShort(ServerOpcode(38)); pck.AddLong(pPlayer->GetAgentId()); pck.AddLong(3); //Add the party window pck.Add(Send_PartyWindow(NULL, pPlayer));//*/ #endif NetMessage s; //s.data=pck.GetString(&s.dataSize); //CoreLog.BinaryDump("ZoneInfo.gwb", s.data, s.dataSize); //Send the data while((s.pData=pck.GetString(&s.dataSize, 2920))!=NULL)//2920 { if (s.pData==NULL){break;} s.networkId=pPlayer->GetnetworkId(); gpGameServer->SendData(&s); } pck.Clear(); //Add the current action queue =D //pPlayer->StartCih(); //pPlayer->SetPingTimeSent(1); list::iterator aar; for (aar=mAgentActionQueue.begin(); aar!=mAgentActionQueue.end(); aar++) { if (!ActionHasExpired(&(*aar))) { ProcessAction(&(*aar), pPlayer); } } //Send current stuff such as level pAgent->Init(); //DEBUG //This is used to prevent keyboard movement //pPlayer->GetAgent()->UpdateVitalStatus(VITAL_STATUS_NO_KB_MOVE, true); //Send once a zone announcements if (pLir->flags.test(LD_NOPASSWORD)) { ConsoleWrite("Your account has no password. Use /password to change your password.", false, pPlayer->GetnetworkId(), COMMAND_COLOR); } return true; }