Ejemplo n.º 1
0
    public void DistributeReward()
    {
        if (!Active)
        {
            return;
        }

        if (Receivers.Count == 0) // Nobody joined
        {
            Active = false;
            GameServer.HongBaoManager.RemoveHongBao(this);
            return;
        }
        short dividedAwardAmount = (short)(RewardAmount / Receivers.Count);

        foreach (Player player in Receivers)
        {
            player.Session.FieldManager.BroadcastPacket(PlayerHostPacket.HongbaoGiftNotice(player, this, dividedAwardAmount));
            player.Session.Send(MeretsPacket.UpdateMerets(player.Account, dividedAwardAmount));
            player.Account.EventMeret.Modify(dividedAwardAmount);
        }

        Active = false;
        GameServer.HongBaoManager.RemoveHongBao(this);
    }
Ejemplo n.º 2
0
    private static void HandleClaim(GameSession session, PacketReader packet)
    {
        int hongBaoId = packet.ReadInt();

        HongBao hongBao = GameServer.HongBaoManager.GetHongBaoById(hongBaoId);

        if (hongBao == null)
        {
            return;
        }

        if (hongBao.Active == false)
        {
            session.Send(PlayerHostPacket.HongbaoGiftNotice(session.Player, hongBao, 0));
            return;
        }

        hongBao.AddReceiver(session.Player);
    }