CWideScanPacket::CWideScanPacket(WIDESCAN_STATUS status) { this->type = 0xF6; this->size = 0x04; WBUFB(data,(0x04)-4) = status; }
CCharAppearancePacket::CCharAppearancePacket(CCharEntity* PChar) { this->type = 0x51; this->size = 0x0C; WBUFB(data,(0x04)-4) = PChar->look.face; WBUFB(data,(0x05)-4) = PChar->look.race; WBUFW(data,(0x06)-4) = PChar->look.head + 0x1000; WBUFW(data,(0x08)-4) = PChar->look.body + 0x2000; WBUFW(data,(0x0A)-4) = PChar->look.hands + 0x3000; WBUFW(data,(0x0C)-4) = PChar->look.legs + 0x4000; WBUFW(data,(0x0E)-4) = PChar->look.feet + 0x5000; WBUFW(data,(0x10)-4) = PChar->look.main + 0x6000; WBUFW(data,(0x12)-4) = PChar->look.sub + 0x7000; WBUFW(data,(0x14)-4) = PChar->look.ranged + 0x8000; }
CShopMenuPacket::CShopMenuPacket(CCharEntity * PChar) { this->type = 0x3E; this->size = 0x04; WBUFB(data,(0x04)-4) = PChar->Container->getItemsCount(); }
CCharRecastPacket::CCharRecastPacket(CCharEntity* PChar) { this->type = 0x19; this->size = 0x7F; uint8 count = 0; RecastList_t* RecastList = PChar->PRecastContainer->GetRecastList(RECAST_ABILITY); for (uint16 i = 0; i < RecastList->size(); ++i) { Recast_t* recast = RecastList->at(i); uint32 recasttime = (recast->RecastTime == 0 ? 0 : ((recast->RecastTime - (time(nullptr) - recast->TimeStamp)))); if (recast->ID != 0) { WBUFL(data, (0x0C + count * 8) ) = recasttime; WBUFB(data, (0x0F + count * 8) ) = recast->ID; count++; } else { WBUFL(data, (0x04) ) = recasttime; // 2h ability (recast id is 0) } } }
CInventoryFinishPacket::CInventoryFinishPacket() { this->type = 0x1D; this->size = 0x04; WBUFB(data,(0x04)-4) = 1; }
CShopItemsPacket::CShopItemsPacket(CCharEntity * PChar) { this->type = 0x3C; this->size = 0x04; uint8 ItemsCount = PChar->Container->getItemsCount(); uint8 i = 0; for (uint8 slotID = 0; slotID < ItemsCount; ++slotID) { if (i == 20) { PChar->pushPacket(new CBasicPacket(*this)); i = 0; this->size = 0x04; memset(data, 0, sizeof(data)); } this->size += 0x06; WBUFL(data,((i*12)+0x08)-4) = PChar->Container->getQuantity(slotID); WBUFW(data,((i*12)+0x0C)-4) = PChar->Container->getItemID(slotID); WBUFB(data,((i*12)+0x0E)-4) = slotID; i++; } }
void CQuestMissionLogPacket::generateCurrentMissionPacket(CCharEntity * PChar) { uint16 add_on_scenarios = 0; add_on_scenarios += PChar->m_missionLog[MISSION_ACP].current; add_on_scenarios += PChar->m_missionLog[MISSION_AMK].current << 0x04; add_on_scenarios += PChar->m_missionLog[MISSION_ASA].current << 0x08; // Not perfect, but they display and missions DO progress. Can fix properly later. There is a delay before when the menu updates. Zoning will force it. uint32 chains = 0; chains = PChar->m_missionLog[MISSION_COP].current + 1; chains = ((chains * 0x08) + 0x60); uint32 soa = (PChar->m_missionLog[MISSION_SOA].current * 2) + 0x6E; uint32 rov = PChar->m_missionLog[MISSION_ROV].current + 0x6C; // While current National Missions + Zilart Mission are updated in this packet, completed missions are sent in a separate one. WBUFB(data, (0x04)) = PChar->profile.nation; // Nation WBUFW(data, (0x08)) = PChar->m_missionLog[PChar->profile.nation].current; // National Missions WBUFW(data, (0x0C)) = PChar->m_missionLog[MISSION_ZILART].current; // Rise of the Zilart // But for COP, Add-On Scenarios, SOA, and ROV, sending the current mission will also update that log's completed missions. WBUFL(data, (0x10)) = chains; // Chains of Promathia Missions //WBUFB(data,(0x16)) = 0x30; // назначение неизвестно WBUFW(data, (0x18)) = add_on_scenarios; // A Crystalline Prophecy, A Moogle Kupo d'Etat, A Shantotto Ascension WBUFW(data, (0x1C)) = soa; // Seekers of Adoulin WBUFW(data, (0x20)) = rov; // Rhapsodies of Vana'diel }
CCharSkillsPacket::CCharSkillsPacket(CCharEntity* PChar) { this->type = 0x62; this->size = 0x80; uint8 count = 0; RecastList_t* RecastList = PChar->PRecastContainer->GetRecastList(RECAST_ABILITY); for (uint16 i = 0; i < RecastList->size(); ++i) { Recast_t* recast = RecastList->at(i); uint32 time = (recast->RecastTime == 0 ? 0 : ((recast->RecastTime - (gettick() - recast->TimeStamp)) / 1000)); if(recast->ID != 0) { WBUFL(data,(0x08 + count*4)-4) = time; WBUFB(data,(0x0B + count*4)-4) = recast->ID; count++; } else { WBUFL(data,(0x04)-4) = time; // 2h ability (recast id is 0) } } memcpy(data+(0x80)-4, &PChar->WorkingSkills, 128); }
/** * Receiving a sex change request (sex is reversed). * @param fd: fd to parse from (char-serv) * @param id: id of char-serv * @param ip: char-serv ip (used for info) * @return 0 not enough info transmitted, 1 success */ int logchrif_parse_reqchgsex(int fd, int id, char* ip){ if( RFIFOREST(fd) < 6 ) return 0; else{ struct mmo_account acc; AccountDB* accounts = login_get_accounts_db(); uint32 account_id = RFIFOL(fd,2); RFIFOSKIP(fd,6); if( !accounts->load_num(accounts, &acc, account_id) ) ShowNotice("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n", ch_server[id].name, account_id, ip); else if( acc.sex == 'S' ) ShowNotice("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n", ch_server[id].name, account_id, ip); else{ unsigned char buf[7]; char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; //Change gender ShowNotice("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n", ch_server[id].name, account_id, sex, ip); acc.sex = sex; // Save accounts->save(accounts, &acc); // announce to other servers WBUFW(buf,0) = 0x2723; WBUFL(buf,2) = account_id; WBUFB(buf,6) = sex_str2num(sex); logchrif_sendallwos(-1, buf, 7); } } return 1; }
CMessageStandardPacket::CMessageStandardPacket(CCharEntity* PChar, uint32 param0, uint32 param1, uint16 MessageID) { this->type = 0x09; this->size = 0x12; WBUFW(data,(0x0A)-4) = MessageID; if (PChar != nullptr) { WBUFL(data,(0x04)-4) = PChar->id; WBUFW(data,(0x08)-4) = PChar->targid; if (MessageID == 0x59) { this->size = 0x30; WBUFB(data,(0x0C)-4) = 0x10; snprintf((int8*)data+(0x0D)-4, 24, "string2 %s", PChar->GetName()); } } else { snprintf((int8*)data+(0x0D)-4, 20, "Para0 %d Para1 %d", param0, param1); } }
CFadeOutPacket::CFadeOutPacket(CBaseEntity * PEntity) { this->type = 0x38; this->size = 0x0A; WBUFL(data,(0x04)-4) = PEntity->id; WBUFL(data,(0x08)-4) = PEntity->id; WBUFB(data,(0x0C)-4) = 0x6b; WBUFB(data,(0x0D)-4) = 0x65; WBUFB(data,(0x0E)-4) = 0x73; WBUFB(data,(0x0F)-4) = 0x75; WBUFW(data,(0x10)-4) = PEntity->targid; WBUFW(data,(0x12)-4) = PEntity->targid; }
CChangeMusicPacket::CChangeMusicPacket(uint8 BlockID, uint8 MusicTrackID) { // Block IDs: // 0 Background Music (Day time, 7:00 -> 18:00) // 1 Background Music (Night time, 18:00 -> 7:00) // 2 SoloBattle Music // 3 Party Battle Music // 4 Chocobo Music // More types likely exist this->type = 0x5F; this->size = 0x04; WBUFB(data,(0x04)-4) = BlockID; // block WBUFB(data,(0x06)-4) = MusicTrackID; // music }
CPartyMemberUpdatePacket::CPartyMemberUpdatePacket(CCharEntity* PChar, uint8 MemberNumber, uint8 ZoneID) { this->type = 0xDD; this->size = 0x18; DSP_DEBUG_BREAK_IF(PChar == NULL); WBUFL(data,(0x04)-4) = PChar->id; if (PChar->PParty != NULL) { uint16 PartyFlags = 0; if (PChar->PParty->GetLeader() == PChar) { PartyFlags += PARTY_LEADER; } if (PChar->PParty->GetQuaterMaster() == PChar) { PartyFlags += PARTY_QM; } if (PChar->PParty->GetSyncTarget() == PChar) { PartyFlags += PARTY_SYNC; } WBUFW(data,(0x14)-4) = PartyFlags; } if (PChar->getZone() != ZoneID) { WBUFB(data,(0x1F)-4) = PChar->getZone(); } else { WBUFW(data,(0x08)-4) = PChar->health.hp; WBUFW(data,(0x0C)-4) = PChar->health.mp; WBUFW(data,(0x10)-4) = PChar->health.tp; WBUFB(data,(0x1D)-4) = PChar->GetHPP(); WBUFB(data,(0x1E)-4) = PChar->GetMPP(); WBUFW(data,(0x18)-4) = PChar->targid; WBUFB(data,(0x1A)-4) = MemberNumber; } memcpy(data+(0x20)-4, PChar->GetName(), PChar->name.size()); }
CShopBuyPacket::CShopBuyPacket(uint8 slotID, uint32 quantity) { this->type = 0x3F; this->size = 0x06; WBUFB(data,(0x04)-4) = slotID; WBUFL(data,(0x08)-4) = quantity; }
CChatMessagePacket::CChatMessagePacket(CCharEntity* PChar, CHAT_MESSAGE_TYPE MessageType, int8* buff) { // Determine the return message length.. int32 buffSize = (strlen(buff) > 108) ? 108 : strlen(buff); // Build the packet.. this->type = 0x17; this->size = dsp_min((32 + (buffSize + 1) + ((4 - ((buffSize + 1) % 4)) % 4)) / 2, 128); WBUFB(data, (0x04) - 4) = MessageType; if (PChar->nameflags.flags & FLAG_GM) WBUFB(data, (0x05) - 4) = 0x01; WBUFW(data, (0x06) - 4) = PChar->getZone(); memcpy(data + (0x08) - 4, PChar->GetName(), PChar->name.size()); memcpy(data + (0x18) - 4, buff, buffSize); }
CMeritPointsCategoriesPacket::CMeritPointsCategoriesPacket(CCharEntity* PChar, MERIT_TYPE merit) { this->type = 0x8C; this->size = 0x08; WBUFB(data,(0x04)-4) = 1; WBUFL(data,(0x08)-4) = PChar->PMeritPoints->GetMerit(merit)->data; }
CShopAppraisePacket::CShopAppraisePacket(uint8 slotID, uint32 sellPrice) { this->type = 0x3D; this->size = 0x08; WBUFL(data,(0x04)) = sellPrice; WBUFB(data,(0x08)) = slotID; }
CDeliveryBoxPacket::CDeliveryBoxPacket(uint8 action, uint8 count) { PROFILE_FUNC(); this->type = 0x4B; this->size = 0x0A; memset(data, 0xFF, 12); WBUFB(data,(0x04)-4) = action; if (action == 0x05) { WBUFB(data,(0x05)-4) = 0x01; WBUFB(data,(0x0E)-4) = count; } WBUFB(data,(0x0C)-4) = 0x01; }
// パーティ設定変更通知 int mapif_party_optionchanged(int fd,struct party *p,int account_id,int flag) { unsigned char buf[16]; WBUFW(buf,0)=0x3823; WBUFL(buf,2)=p->party_id; WBUFL(buf,6)=account_id; WBUFB(buf,10)=p->exp; WBUFB(buf,11)=p->item; WBUFB(buf,12)=flag; if(flag==0) mapif_sendall(buf,13); else mapif_send(fd,buf,13); printf("int_party: option changed %d %d %d %d %d\n",p->party_id,account_id,p->exp,p->item,flag); return 0; }
CLinkshellEquipPacket::CLinkshellEquipPacket(CCharEntity* PChar) { PROFILE_FUNC(); this->type = 0xE0; this->size = 0x04; WBUFB(data,(0x04)-4) = PChar->equip[SLOT_LINK]; }
CEventPacket::CEventPacket( CCharEntity* PChar, uint16 EventID, uint8 numOfParams, uint32 param0, uint32 param1, uint32 param2, uint32 param3, uint32 param4, uint32 param5, uint32 param6, uint32 param7, int16 textTable) { this->type = 0x32; this->size = 0x0A; WBUFL(data,(0x04)-4) = PChar->id; if(numOfParams > 0) { this->type = 0x34; this->size = 0x1A; WBUFL(data,(0x08)-4) = param0; WBUFL(data,(0x0C)-4) = param1; WBUFL(data,(0x10)-4) = param2; WBUFL(data,(0x14)-4) = param3; WBUFL(data,(0x18)-4) = param4; WBUFL(data,(0x1C)-4) = param5; WBUFL(data,(0x20)-4) = param6; WBUFL(data,(0x24)-4) = param7; WBUFW(data,(0x28)-4) = PChar->m_TargID; WBUFW(data,(0x2A)-4) = (PChar->getZone() != 0 ? PChar->getZone() : PChar->loc.prevzone); if (textTable != -1) { WBUFW(data,(0x30)-4) = textTable; } else { WBUFW(data,(0x30)-4) = (PChar->getZone() != 0 ? PChar->getZone() : PChar->loc.prevzone); } WBUFW(data,(0x2C)-4) = EventID; WBUFB(data,(0x2E)-4) = 8; // если патаметров меньше, чем 8, то после завершения события камера "прыгнет" за спину персонажу } else { WBUFW(data,(0x08)-4) = PChar->targid; WBUFW(data,(0x0C)-4) = EventID; WBUFW(data,(0x0A)-4) = (PChar->getZone() != 0 ? PChar->getZone() : PChar->loc.prevzone); WBUFW(data,(0x10)-4) = (PChar->getZone() != 0 ? PChar->getZone() : PChar->loc.prevzone); } PChar->m_event.EventID = EventID; }
CInventorySizePacket::CInventorySizePacket(CCharEntity* PChar) { this->type = 0x1C; this->size = 0x1A; WBUFB(data,(0x04)-4) = 1 + PChar->getStorage(LOC_INVENTORY)->GetSize(); WBUFB(data,(0x05)-4) = 1 + PChar->getStorage(LOC_MOGSAFE)->GetSize(); WBUFB(data,(0x06)-4) = 1 + PChar->getStorage(LOC_STORAGE)->GetSize(); WBUFB(data,(0x07)-4) = 1 + PChar->getStorage(LOC_TEMPITEMS)->GetSize(); WBUFB(data,(0x08)-4) = 1 + PChar->getStorage(LOC_MOGLOCKER)->GetSize(); WBUFB(data,(0x09)-4) = 1 + PChar->getStorage(LOC_MOGSATCHEL)->GetSize(); WBUFB(data,(0x0A)-4) = 1 + PChar->getStorage(LOC_MOGSACK)->GetSize(); WBUFW(data,(0x14)-4) = 1 + PChar->getStorage(LOC_INVENTORY)->GetBuff(); WBUFW(data,(0x16)-4) = 1 + PChar->getStorage(LOC_MOGSAFE)->GetBuff(); WBUFW(data,(0x18)-4) = 1 + PChar->getStorage(LOC_STORAGE)->GetBuff(); WBUFW(data,(0x1A)-4) = 1 + PChar->getStorage(LOC_TEMPITEMS)->GetBuff(); if (charutils::hasMogLockerAccess(PChar)) { WBUFW(data,(0x1C)-4) = 1 + PChar->getStorage(LOC_MOGLOCKER)->GetBuff(); } else { WBUFW(data,(0x1C)-4) = 0x00; } WBUFW(data,(0x1E)-4) = 1 + PChar->getStorage(LOC_MOGSATCHEL)->GetBuff(); WBUFW(data,(0x20)-4) = 1 + PChar->getStorage(LOC_MOGSACK)->GetBuff(); }
// Wis sending result int mapif_wis_end (struct WisData *wd, int flag) { unsigned char buf[27]; WBUFW (buf, 0) = 0x3802; memcpy (WBUFP (buf, 2), wd->src, 24); WBUFB (buf, 26) = flag; mapif_send (wd->fd, buf, 27); return 0; }
// パーティ解散通知 void mapif_party_broken(int party_id, int flag) { unsigned char buf[7]; WBUFW(buf, 0) = 0x3826; WBUFL(buf, 2) = party_id; WBUFB(buf, 6) = flag; mapif_sendall(buf, 7); PRINTF("int_party: broken %d\n", party_id); }
CBazaarPurchasePacket::CBazaarPurchasePacket(CCharEntity* PChar, bool result) { this->type = 0x06; // 0x106 this->size = 0x0D; WBUFB(data,(0x04)-4) = !result; memcpy(data+(0x08)-4, PChar->GetName(), PChar->name.size()); }
CChocoboDiggingPacket::CChocoboDiggingPacket(CCharEntity* PChar) { this->type = 0x2F; this->size = 0x06; WBUFL(data,(0x04)-4) = PChar->id; WBUFW(data,(0x08)-4) = PChar->targid; WBUFB(data,(0x0A)-4) = 0x01; }
CLoginPacket::CLoginPacket(CPlayer* player, LOGINRESPONSE response) { this->type = 0x01; this->size = 0x0B; WBUFB(packet, 0x02) = response; WBUFL(packet, 0x03) = player->GetWins(); WBUFL(packet, 0x07) = player->GetLosses(); }
CServerIPPacket::CServerIPPacket(CCharEntity* PChar, uint8 type) { this->type = 0x0B; this->size = 0x0E; WBUFB(data,(0x04)-4) = type; WBUFL(data,(0x08)-4) = PChar->loc.zone->GetIP(); WBUFW(data,(0x0C)-4) = PChar->loc.zone->GetPort(); }
// Wisp/page transmission result to map-server static void mapif_wis_end(struct WisData *wd, int flag) { uint8_t buf[27]; WBUFW(buf, 0) = 0x3802; WBUF_STRING(buf, 2, wd->src.to__actual(), 24); WBUFB(buf, 26) = flag; // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target mapif_send(wd->fd, buf, 27); }
//Dissolution party notification int mapif_party_broken(int party_id, int flag) { unsigned char buf[16]; WBUFW(buf,0)=0x3826; WBUFL(buf,2)=party_id; WBUFB(buf,6)=flag; mapif->sendall(buf,7); //printf("int_party: broken %d\n",party_id); return 0; }