[Commands] Remove #guildapprove, #guildcreate, and #guildlist Commands (#2775)

# Notes
- Removes `#guildapprove`, `#guildcreate`, and `#guildlist`.
- Removes associated functions, classes, etc. that were only used in these commands.
- These commands are unused and/or covered by the general `#guild` command.
- Approvals don't really seem to be a thing anymore and the variable itself doesn't exist in stock PEQ database anyway.
This commit is contained in:
Alex King
2023-01-22 12:56:42 -05:00
committed by GitHub
parent 35c3778baf
commit d0edb93d62
7 changed files with 0 additions and 291 deletions
-219
View File
@@ -652,79 +652,11 @@ void ZoneGuildManager::RequestOnlineGuildMembers(uint32 FromID, uint32 GuildID)
safe_delete(pack);
}
void ZoneGuildManager::ProcessApproval()
{
LinkedListIterator<GuildApproval*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
if(!iterator.GetData()->ProcessApproval())
iterator.RemoveCurrent();
iterator.Advance();
}
}
void ZoneGuildManager::AddGuildApproval(const char* guildname,Client* owner)
{
auto tmp = new GuildApproval(guildname, owner, GetFreeID());
list.Insert(tmp);
}
void ZoneGuildManager::AddMemberApproval(uint32 refid,Client* name)
{
GuildApproval* tmp = FindGuildByIDApproval(refid);
if(tmp != 0)
{
if(!tmp->AddMemberApproval(name))
name->Message(Chat::White,"Unable to add to list.");
else
{
name->Message(Chat::White,"Added to list.");
}
}
else
name->Message(Chat::White,"Unable to find guild reference id.");
}
ZoneGuildManager::~ZoneGuildManager()
{
ClearGuilds();
}
void ZoneGuildManager::ClearGuildsApproval()
{
list.Clear();
}
GuildApproval* ZoneGuildManager::FindGuildByIDApproval(uint32 refid)
{
LinkedListIterator<GuildApproval*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
if(iterator.GetData()->GetID() == refid)
return iterator.GetData();
iterator.Advance();
}
return 0;
}
GuildApproval* ZoneGuildManager::FindGuildByOwnerApproval(Client* owner)
{
LinkedListIterator<GuildApproval*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
if(iterator.GetData()->GetOwner() == owner)
return iterator.GetData();
iterator.Advance();
}
return 0;
}
GuildBankManager::~GuildBankManager()
{
auto Iterator = Banks.begin();
@@ -1524,154 +1456,3 @@ bool GuildBankManager::AllowedToWithdraw(uint32 GuildID, uint16 Area, uint16 Slo
return false;
}
/*================== GUILD APPROVAL ========================*/
bool GuildApproval::ProcessApproval()
{
if(owner && owner->GuildID() != 0)
{
owner->Message(Chat::NPCQuestSay,"You are already in a guild! Guild request deleted.");
return false;
}
if(deletion_timer->Check() || !owner)
{
if(owner)
owner->Message(Chat::White,"You took too long! Your guild request has been deleted.");
return false;
}
return true;
}
GuildApproval::GuildApproval(const char* guildname, Client* owner,uint32 id)
{
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
deletion_timer = new Timer(1800000);
strcpy(guild,guildname);
owner = owner;
refid = id;
if(owner)
owner->Message(Chat::White,"You can now start getting your guild approved, tell your %i members to #guildapprove %i, you have 30 minutes to create your guild.",tmp,GetID());
for(int i=0;i<tmp;i++)
members[i] = 0;
}
GuildApproval::~GuildApproval()
{
safe_delete(deletion_timer);
}
bool GuildApproval::AddMemberApproval(Client* addition)
{
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
for(int i=0;i<tmp;i++)
{
if(members[i] && members[i] == addition)
return false;
}
for(int i=0;i<tmp;i++)
{
if(!members[i])
{
members[i] = addition;
int z=0;
for(int i=0;i<tmp;i++)
{
if(members[i])
z++;
}
if(z==tmp)
GuildApproved();
return true;
}
}
return false;
}
void GuildApproval::ApprovedMembers(Client* requestee)
{
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
for(int i=0;i<tmp;i++)
{
if(members[i])
requestee->Message(Chat::White,"%i: %s",i,members[i]->GetName());
}
}
void GuildApproval::GuildApproved()
{
char petitext[PBUFFER] = "A new guild was founded! Guildname: ";
char gmembers[MBUFFER] = " ";
if(!owner)
return;
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
uint32 tmpeq = guild_mgr.CreateGuild(guild, owner->CharacterID());
guild_mgr.SetGuild(owner->CharacterID(),tmpeq,2);
owner->SendAppearancePacket(AT_GuildID,true,false);
for(int i=0;i<tmp;i++)
{
if(members[i])
{
owner->Message(Chat::White, "%s",members[i]->GetName());
owner->Message(Chat::White, "%i",members[i]->CharacterID());
guild_mgr.SetGuild(members[i]->CharacterID(),tmpeq,0);
size_t len = MBUFFER - strlen(gmembers)+1;
strncat(gmembers," ",len);
strncat(gmembers,members[i]->GetName(),len);
}
}
size_t len = PBUFFER - strlen(petitext)+1;
strncat(petitext,guild,len);
strncat(petitext," Leader: ",len);
strncat(petitext,owner->CastToClient()->GetName(),len);
strncat(petitext," Members:",len);
strncat(petitext,gmembers,len);
auto pet = new Petition(owner->CastToClient()->CharacterID());
pet->SetAName(owner->CastToClient()->AccountName());
pet->SetClass(owner->CastToClient()->GetClass());
pet->SetLevel(owner->CastToClient()->GetLevel());
pet->SetCName(owner->CastToClient()->GetName());
pet->SetRace(owner->CastToClient()->GetRace());
pet->SetLastGM("");
pet->SetCName(owner->CastToClient()->GetName()); //aza77 is this really 2 times needed ??
pet->SetPetitionText(petitext);
pet->SetZone(zone->GetZoneID());
pet->SetUrgency(0);
petition_list.AddPetition(pet);
database.InsertPetitionToDB(pet);
petition_list.UpdateGMQueue();
petition_list.UpdateZoneListQueue();
worldserver.SendEmoteMessage(
0,
0,
AccountStatus::QuestTroupe,
Chat::Yellow,
fmt::format(
"{} has made a petition. ID: {}",
owner->CastToClient()->GetName(),
pet->GetID()
).c_str()
);
auto pack = new ServerPacket;
pack->opcode = ServerOP_RefreshGuild;
pack->size = tmp;
pack->pBuffer = new uchar[pack->size];
memcpy(pack->pBuffer, &tmpeq, 4);
worldserver.SendPacket(pack);
safe_delete(pack);
owner->Message(Chat::White, "Your guild was created.");
owner = 0;
}