void HandlePetitionRenameGuild(PetitionRenameGuild packet) { Item item = GetPlayer().GetItemByGuid(packet.PetitionGuid); if (!item) { return; } if (Global.GuildMgr.GetGuildByName(packet.NewGuildName)) { Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NameExists_S, packet.NewGuildName); return; } if (Global.ObjectMgr.IsReservedName(packet.NewGuildName) || !ObjectManager.IsValidCharterName(packet.NewGuildName)) { Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NameInvalid, packet.NewGuildName); return; } PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_PETITION_NAME); stmt.AddValue(0, packet.NewGuildName); stmt.AddValue(1, packet.PetitionGuid.GetCounter()); DB.Characters.Execute(stmt); PetitionRenameGuildResponse renameResponse = new PetitionRenameGuildResponse(); renameResponse.PetitionGuid = packet.PetitionGuid; renameResponse.NewGuildName = packet.NewGuildName; SendPacket(renameResponse); }
void HandlePetitionRenameGuild(PetitionRenameGuild packet) { Item item = GetPlayer().GetItemByGuid(packet.PetitionGuid); if (!item) { return; } Petition petition = Global.PetitionMgr.GetPetition(packet.PetitionGuid); if (petition == null) { Log.outDebug(LogFilter.Network, $"CMSG_PETITION_QUERY failed for petition {packet.PetitionGuid}"); return; } if (Global.GuildMgr.GetGuildByName(packet.NewGuildName)) { Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NameExists_S, packet.NewGuildName); return; } if (Global.ObjectMgr.IsReservedName(packet.NewGuildName) || !ObjectManager.IsValidCharterName(packet.NewGuildName)) { Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NameInvalid, packet.NewGuildName); return; } // update petition storage petition.UpdateName(packet.NewGuildName); PetitionRenameGuildResponse renameResponse = new PetitionRenameGuildResponse(); renameResponse.PetitionGuid = packet.PetitionGuid; renameResponse.NewGuildName = packet.NewGuildName; SendPacket(renameResponse); }