Exemple #1
0
        private static void HandleUseBuff(GameSession session, PacketReader packet)
        {
            int buffId = packet.ReadInt();

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

            if (guild == null)
            {
                return;
            }

            int buffLevel = guild.Buffs.FirstOrDefault(x => x.Id == buffId).Level;

            GuildBuffLevel buff = GuildBuffMetadataStorage.GetGuildBuffLevelData(buffId, buffLevel);

            if (buff == null)
            {
                return;
            }

            if (buffId > 1000)
            {
                if (!session.Player.Wallet.Meso.Modify(-buff.Cost))
                {
                    return;
                }
            }
            else
            {
                if (buff.Cost > guild.Funds)
                {
                    return;
                }
                guild.Funds -= buff.Cost;
            }
            session.Send(GuildPacket.ActivateBuff(buffId));
            session.Send(GuildPacket.UseBuffNotice(buffId));
        }