예제 #1
0
        private static void HandleChangeHomeTheme(GameSession session, PacketReader packet)
        {
            int themeId = packet.ReadInt();

            Guild guild = GameServer.GuildManager.GetGuildById(session.Player.Guild.Id);

            if (guild == null || guild.LeaderCharacterId != session.Player.CharacterId)
            {
                return;
            }

            GuildHouseMetadata houseMetadata = GuildHouseMetadataStorage.GetMetadataByThemeId(guild.HouseRank, themeId);

            if (houseMetadata == null)
            {
                return;
            }

            GuildPropertyMetadata guildProperty = GuildPropertyMetadataStorage.GetMetadata(guild.Exp);

            if (guild.Funds < houseMetadata.UpgradeCost)
            {
                return;
            }

            guild.ModifyFunds(session, guildProperty, -houseMetadata.RethemeCost);
            guild.HouseTheme = houseMetadata.Theme;
            guild.BroadcastPacketGuild(GuildPacket.ChangeHouse(session.Player.Name, guild.HouseRank, guild.HouseTheme));
        }
예제 #2
0
        private static void HandleUpgradeHome(GameSession session, PacketReader packet)
        {
            int themeId = packet.ReadInt();

            Guild guild = GameServer.GuildManager.GetGuildById(session.Player.Guild.Id);

            if (guild == null || guild.Leader != session.Player)
            {
                return;
            }

            GuildHouseMetadata houseMetadata = GuildHouseMetadataStorage.GetMetadataByThemeId(guild.HouseRank + 1, themeId);

            if (houseMetadata == null)
            {
                return;
            }

            GuildPropertyMetadata guildProperty = GuildPropertyMetadataStorage.GetMetadata(guild.Exp);

            if (guildProperty.Level < houseMetadata.RequiredLevel ||
                guild.Funds < houseMetadata.UpgradeCost)
            {
                return;
            }

            guild.ModifyFunds(session, guildProperty, -houseMetadata.UpgradeCost);
            guild.HouseRank  = houseMetadata.Level;
            guild.HouseTheme = houseMetadata.Theme;
            guild.BroadcastPacketGuild(GuildPacket.ChangeHouse(session.Player.Name, guild.HouseRank, guild.HouseTheme)); // need to confirm if this is the packet used when upgrading
        }