void Client::SendGuildMembers() { uint32 len; uint8 *data = guild_mgr.MakeGuildMembers(GuildID(), GetName(), len); if(data == nullptr) return; //invalid guild, shouldent happen. auto outapp = new EQApplicationPacket(OP_GuildMemberList); outapp->size = len; outapp->pBuffer = data; data = nullptr; Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); FastQueuePacket(&outapp); auto pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct)); ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer; srogms->FromID = CharacterID(); srogms->GuildID = GuildID(); worldserver.SendPacket(pack); safe_delete(pack); // We need to send the Guild URL and Channel name again, as sending OP_GuildMemberList appears to clear this information out. SendGuildURL(); SendGuildChannel(); }
void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag SendAppearancePacket(AT_GuildID, GUILD_NONE); Log.Out(Logs::Detail, Logs::Guilds, "Sending spawn appearance for no guild tag."); } else { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); Log.Out(Logs::Detail, Logs::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); SendAppearancePacket(AT_GuildRank, rank); } UpdateWho(); }
void Client::SendGuildMOTD(bool GetGuildMOTDReply) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMOTD, sizeof(GuildMOTD_Struct)); // When the Client gets an OP_GuildMOTD, it compares the text to the version it has previously stored. // If the text in the OP_GuildMOTD packet is the same, it does nothing. If not the same, it displays // the new MOTD and then stores the new text. // GuildMOTD_Struct *motd = (GuildMOTD_Struct *) outapp->pBuffer; motd->unknown0 = 0; strn0cpy(motd->name, m_pp.name, 64); if(IsInAGuild()) { if(!guild_mgr.GetGuildMOTD(GuildID(), motd->motd, motd->setby_name)) { motd->setby_name[0] = '\0'; strcpy(motd->motd, "ERROR GETTING MOTD!"); } } else { //we have to send them an empty MOTD anywyas. motd->motd[0] = '\0'; //just to be sure motd->setby_name[0] = '\0'; //just to be sure } Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); FastQueuePacket(&outapp); }
void Client::SendGuildMOTD(bool GetGuildMOTDReply) { auto outapp = new EQApplicationPacket(OP_GuildMOTD, sizeof(GuildMOTD_Struct)); // When the Client gets an OP_GuildMOTD, it compares the text to the version it has previously stored. // If the text in the OP_GuildMOTD packet is the same, it does nothing. If not the same, it displays // the new MOTD and then stores the new text. // // When the Client receives an OP_GetGuildMOTDReply, it displays the text in the packet. // // So OP_GuildMOTD should be sent on zone entry and when an Officer changes the MOTD, and OP_GetGuildMOTDReply // should be sent when the client issues the /getguildmotd command. // if(GetGuildMOTDReply) outapp->SetOpcode(OP_GetGuildMOTDReply); GuildMOTD_Struct *motd = (GuildMOTD_Struct *) outapp->pBuffer; motd->unknown0 = 0; strn0cpy(motd->name, m_pp.name, 64); if(IsInAGuild()) { if(!guild_mgr.GetGuildMOTD(GuildID(), motd->motd, motd->setby_name)) { motd->setby_name[0] = '\0'; strcpy(motd->motd, "ERROR GETTING MOTD!"); } } else { //we have to send them an empty MOTD anywyas. motd->motd[0] = '\0'; //just to be sure motd->setby_name[0] = '\0'; //just to be sure } Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); FastQueuePacket(&outapp); }
void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag SendAppearancePacket(AT_GuildID, GUILD_NONE); Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for no guild tag."); } else { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF) { switch (rank) { case 0: { rank = 5; break; } // GUILD_MEMBER 0 case 1: { rank = 3; break; } // GUILD_OFFICER 1 case 2: { rank = 1; break; } // GUILD_LEADER 2 default: { break; } // GUILD_NONE } } SendAppearancePacket(AT_GuildRank, rank); } UpdateWho(); }
void Client::RefreshGuildInfo() { uint32 OldGuildID = guild_id; guildrank = GUILD_RANK_NONE; guild_id = GUILD_NONE; bool WasBanker = GuildBanker; CharGuildInfo info; if(!guild_mgr.GetCharInfo(CharacterID(), info)) { Log(Logs::Detail, Logs::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); return; } guildrank = info.rank; guild_id = info.guild_id; GuildBanker = info.banker || guild_mgr.IsGuildLeader(GuildID(), CharacterID()); if(((int)zone->GetZoneID() == RuleI(World, GuildBankZoneID))) { if(WasBanker != GuildBanker) { auto outapp = new EQApplicationPacket(OP_SetGuildRank, sizeof(GuildSetRank_Struct)); GuildSetRank_Struct *gsrs = (GuildSetRank_Struct*)outapp->pBuffer; gsrs->Rank = guildrank; strn0cpy(gsrs->MemberName, GetName(), sizeof(gsrs->MemberName)); gsrs->Banker = GuildBanker; FastQueuePacket(&outapp); } if((guild_id != OldGuildID) && GuildBanks) { // Unsure about this for RoF+ ... But they don't have that action anymore so f**k it if (ClientVersion() < EQEmu::versions::ClientVersion::RoF) ClearGuildBank(); if(guild_id != GUILD_NONE) GuildBanks->SendGuildBank(this); } } SendGuildSpawnAppearance(); }
void Client::RefreshGuildInfo() { uint32 OldGuildID = guild_id; guildrank = GUILD_RANK_NONE; guild_id = GUILD_NONE; bool WasBanker = GuildBanker; CharGuildInfo info; if(!guild_mgr.GetCharInfo(CharacterID(), info)) { mlog(GUILDS__ERROR, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); return; } guildrank = info.rank; guild_id = info.guild_id; GuildBanker = info.banker || guild_mgr.IsGuildLeader(GuildID(), CharacterID()); if(((int)zone->GetZoneID() == RuleI(World, GuildBankZoneID))) { if(WasBanker != GuildBanker) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_SetGuildRank, sizeof(GuildSetRank_Struct)); GuildSetRank_Struct *gsrs = (GuildSetRank_Struct*)outapp->pBuffer; gsrs->Rank = guildrank; strn0cpy(gsrs->MemberName, GetName(), sizeof(gsrs->MemberName)); gsrs->Banker = GuildBanker; FastQueuePacket(&outapp); } if((guild_id != OldGuildID) && GuildBanks) { ClearGuildBank(); if(guild_id != GUILD_NONE) GuildBanks->SendGuildBank(this); } } SendGuildSpawnAppearance(); }
void Client::SendGuildURL() { if(GetClientVersion() < EQClientSoF) return; if(IsInAGuild()) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel, sizeof(GuildUpdateURLAndChannel_Struct)); GuildUpdateURLAndChannel_Struct *guuacs = (GuildUpdateURLAndChannel_Struct*) outapp->pBuffer; if(guild_mgr.GetGuildURL(GuildID(), guuacs->Text)) { guuacs->Action = 0; FastQueuePacket(&outapp); } else safe_delete(outapp); } }
void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r) { //this is called once the client is fully allowed to zone here //it takes care of all the activities which occur when a client zones out SendLogoutPackets(); //dont clear aggro until the zone is successful entity_list.RemoveFromHateLists(this); if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); LogFile->write(EQEMuLog::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it x_pos = dest_x; //these coordinates will now be saved when ~client is called y_pos = dest_y; z_pos = dest_z; heading = dest_h; // Cripp: fix for zone heading m_pp.heading = dest_h; m_pp.zone_id = zone_id; m_pp.zoneInstance = instance_id; //Force a save so its waiting for them when they zone Save(2); if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) { // No need to ask worldserver if we're zoning to ourselves (most // likely to a bind point), also fixes a bug since the default response was failure EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZoneChange,sizeof(ZoneChange_Struct)); ZoneChange_Struct* zc2 = (ZoneChange_Struct*) outapp->pBuffer; strcpy(zc2->char_name, GetName()); zc2->zoneID = zone_id; zc2->instanceID = instance_id; zc2->success = 1; outapp->priority = 6; FastQueuePacket(&outapp); zone->StartShutdownTimer(AUTHENTICATION_TIMEOUT * 1000); } else { // vesuvias - zoneing to another zone so we need to the let the world server //handle things with the client for a while ServerPacket* pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct)); ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer; ztz->response = 0; ztz->current_zone_id = zone->GetZoneID(); ztz->current_instance_id = zone->GetInstanceID(); ztz->requested_zone_id = zone_id; ztz->requested_instance_id = instance_id; ztz->admin = admin; ztz->ignorerestrictions = ignore_r; strcpy(ztz->name, GetName()); ztz->guild_id = GuildID(); worldserver.SendPacket(pack); safe_delete(pack); } //reset to unsolicited. zone_mode = ZoneUnsolicited; zonesummon_x = 0; zonesummon_y = 0; zonesummon_z = 0; zonesummon_id = 0; zonesummon_ignorerestrictions = 0; }