mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Fix] Add client packets to questmanager:setguild (#4732)
This commit is contained in:
parent
23c4aa241b
commit
89e3b2c72e
@ -754,7 +754,7 @@ void Perl__setsky(uint8 new_sky)
|
||||
|
||||
void Perl__setguild(uint32_t guild_id, uint8_t guild_rank_id)
|
||||
{
|
||||
quest_manager.setguild(guild_id, guild_rank_id);
|
||||
quest_manager.SetGuild(guild_id, guild_rank_id);
|
||||
}
|
||||
|
||||
void Perl__createguild(const char* guild_name, const char* leader_name)
|
||||
|
||||
@ -91,6 +91,8 @@ void command_guild(Client* c, const Seperator* sep)
|
||||
else {
|
||||
auto guild_name = sep->argplus[3];
|
||||
auto guild_id = guild_mgr.CreateGuild(sep->argplus[3], leader_id);
|
||||
auto leader = entity_list.GetClientByCharID(leader_id);
|
||||
|
||||
|
||||
LogGuilds(
|
||||
"[{}]: Creating guild [{}] with leader [{}] with GM command. It was given id [{}]",
|
||||
@ -115,7 +117,7 @@ void command_guild(Client* c, const Seperator* sep)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
if (!guild_mgr.SetGuild(leader_id, guild_id, GUILD_LEADER)) {
|
||||
if (!guild_mgr.SetGuild(leader, guild_id, GUILD_LEADER)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
@ -268,6 +270,7 @@ void command_guild(Client* c, const Seperator* sep)
|
||||
database.GetCharacterID(sep->arg[2])
|
||||
);
|
||||
auto character_name = database.GetCharNameByID(character_id);
|
||||
auto client = entity_list.GetClientByCharID(character_id);
|
||||
if (!character_id || character_name.empty()) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@ -305,14 +308,14 @@ void command_guild(Client* c, const Seperator* sep)
|
||||
"{} ({}) has {} put into {} ({}).",
|
||||
character_name,
|
||||
character_id,
|
||||
guild_mgr.SetGuild(character_id, guild_id, GUILD_MEMBER) ? "been" : "failed to be",
|
||||
guild_mgr.SetGuild(client, guild_id, GUILD_MEMBER) ? "been" : "failed to be",
|
||||
guild_mgr.GetGuildNameByID(guild_id),
|
||||
guild_id
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
else {
|
||||
guild_mgr.SetGuild(character_id, GUILD_NONE, 0);
|
||||
guild_mgr.SetGuild(client, GUILD_NONE, 0);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
|
||||
@ -1317,42 +1317,6 @@ bool GuildBankManager::SplitStack(uint32 guild_id, uint16 slot_id, uint32 quanti
|
||||
return true;
|
||||
}
|
||||
|
||||
// void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 slotID, uint32 quantity)
|
||||
// {
|
||||
// // Helper method for MergeStacks. Assuming all passed parameters are valid.
|
||||
// //
|
||||
// std::string query = StringFormat("UPDATE `guild_bank` SET `qty` = %i "
|
||||
// "WHERE `guildid` = %i AND `area` = %i "
|
||||
// "AND `slot` = %i LIMIT 1",
|
||||
// quantity, guildID, area, slotID);
|
||||
// auto results = database.QueryDatabase(query);
|
||||
// if(!results.Success()) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// bool GuildBankManager::AllowedToWithdraw(uint32 guild_id, uint16 area, uint16 slot_id, const char *name)
|
||||
// {
|
||||
// auto guild_bank = GetGuildBank(guild_id);
|
||||
// if (!guild_bank) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (area != GuildBankMainArea) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// auto item = &guild_bank->items.main_area[slot_id];
|
||||
// uint8 permissions = item->permissions;
|
||||
//
|
||||
// if (permissions == GuildBankBankerOnly) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
int32 GuildBankManager::NextFreeBankSlot(uint32 guild_id, uint32 area)
|
||||
{
|
||||
auto guild_bank = GetGuildBank(guild_id);
|
||||
@ -1760,3 +1724,38 @@ void GuildBankManager::SendGuildBankItemUpdate(uint32 guild_id, int32 slot_id, u
|
||||
|
||||
entity_list.QueueClientsGuildBankItemUpdate(&gbius, guild_id);
|
||||
}
|
||||
|
||||
bool ZoneGuildManager::SetGuild(Client *client, uint32 guild_id, uint8 rank)
|
||||
{
|
||||
if (!client || rank > GUILD_MAX_RANK || !GetGuildByGuildID(guild_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rank <= GUILD_RANK_NONE) {
|
||||
rank = GUILD_RECRUIT;
|
||||
}
|
||||
|
||||
const uint32 current_guild_id = client->GuildID();
|
||||
if (current_guild_id == guild_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (current_guild_id != guild_id && current_guild_id != GUILD_NONE) {
|
||||
guild_mgr.RemoveMember(client->GuildID(), client->CharacterID(), std::string(client->GetCleanName()));
|
||||
}
|
||||
|
||||
client->SetGuildID(guild_id);
|
||||
client->SetGuildRank(rank);
|
||||
MemberAdd(
|
||||
guild_id,
|
||||
client->CharacterID(),
|
||||
client->GetLevel(),
|
||||
client->GetClass(),
|
||||
rank,
|
||||
client->GetZoneID(),
|
||||
client->GetName()
|
||||
);
|
||||
|
||||
client->SendGuildSpawnAppearance();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@ public:
|
||||
void ListGuilds(Client *c, uint32 guild_id = 0) const;
|
||||
void DescribeGuild(Client *c, uint32 guild_id) const;
|
||||
bool IsActionABankAction(GuildAction action);
|
||||
bool SetGuild(Client *client, uint32 guild_id, uint8 rank);
|
||||
|
||||
uint8 *MakeGuildMembers(uint32 guild_id, const char* prefix_name, uint32& length);
|
||||
void SendToWorldMemberLevelUpdate(uint32 guild_id, uint32 level, std::string player_name);
|
||||
|
||||
@ -468,7 +468,7 @@ void lua_set_sky(int sky) {
|
||||
}
|
||||
|
||||
void lua_set_guild(int guild_id, int rank) {
|
||||
quest_manager.setguild(guild_id, rank);
|
||||
quest_manager.SetGuild(guild_id, rank);
|
||||
}
|
||||
|
||||
void lua_create_guild(const char *name, const char *leader) {
|
||||
|
||||
@ -1623,10 +1623,10 @@ void QuestManager::setsky(uint8 new_sky) {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void QuestManager::setguild(uint32 new_guild_id, uint8 new_rank) {
|
||||
void QuestManager::SetGuild(uint32 new_guild_id, uint8 new_rank) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator) {
|
||||
guild_mgr.SetGuild(initiator->CharacterID(), new_guild_id, new_rank);
|
||||
guild_mgr.SetGuild(initiator, new_guild_id, new_rank);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1681,7 +1681,7 @@ void QuestManager::CreateGuild(const char *guild_name, const char *leader) {
|
||||
gid
|
||||
).c_str()
|
||||
);
|
||||
if (!guild_mgr.SetGuild(character_id, gid, GUILD_LEADER)) {
|
||||
if (!guild_mgr.SetGuild(initiator, gid, GUILD_LEADER)) {
|
||||
worldserver.SendEmoteMessage(
|
||||
0,
|
||||
0,
|
||||
|
||||
@ -152,7 +152,7 @@ public:
|
||||
void faction(int faction_id, int faction_value, int temp);
|
||||
void rewardfaction(int faction_id, int faction_value);
|
||||
void setsky(uint8 new_sky);
|
||||
void setguild(uint32 new_guild_id, uint8 new_rank);
|
||||
void SetGuild(uint32 new_guild_id, uint8 new_rank);
|
||||
void CreateGuild(const char *guild_name, const char *leader);
|
||||
void settime(uint8 new_hour, uint8 new_min, bool update_world = true);
|
||||
void itemlink(int item_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user