Exemplo n.º 1
0
        public override bool TakeCard(Player player, int index)
        {
            //if (player.CanTakeOut == 0)
            //    return false;

            if (player.IsActive == false || index < 0 || index > Cards.Length || player.FinishTakeCard || Cards[index] > 0)
            {
                return(false);
            }

            int             gold       = 0;
            int             money      = 0;
            int             giftToken  = 0;
            int             templateID = 0;
            List <ItemInfo> infos      = null;

            if (DropInventory.CardDrop(RoomType, ref infos))
            {
                if (infos != null)
                {
                    foreach (ItemInfo info in infos)
                    {
                        ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken);
                        if (info != null)
                        {
                            templateID = info.TemplateID;
                            player.PlayerDetail.AddTemplate(info, eBageType.TempBag, info.Count);
                        }
                    }
                }
                else
                {
                    gold = 100;
                }
            }
            if (RoomType == eRoomType.Treasure || RoomType == eRoomType.Boss)
            {
                player.CanTakeOut--;
                if (player.CanTakeOut == 0)
                {
                    player.FinishTakeCard = true;
                }
            }
            else
            {
                player.FinishTakeCard = true;
            }
            Cards[index] = 1;

            SendGamePlayerTakeCard(player, index, templateID, gold, money, giftToken);
            return(true);
        }
Exemplo n.º 2
0
        public override bool TakeCard(Player player, int index)
        {
            if (player.CanTakeOut == 0 || !player.IsActive || index < 0 || index > this.Cards.Length || player.FinishTakeCard || this.Cards[index] > 0)
            {
                return(false);
            }
            player.CanTakeOut--;
            int             value  = 0;
            int             num    = 0;
            int             value2 = 0;
            int             num2   = 0;
            int             num3   = 0;
            int             count  = 0;
            List <ItemInfo> list   = null;

            if (DropInventory.CardDrop(base.RoomType, ref list) && list != null)
            {
                foreach (ItemInfo current in list)
                {
                    num3  = current.TemplateID;
                    count = current.Count;
                    ItemInfo.FindSpecialItemInfo(current, ref value, ref num, ref value2, ref num2);
                    if (num3 > 0)
                    {
                        player.PlayerDetail.AddTemplate(current, current.Template.BagType, current.Count);
                    }
                }
            }
            player.FinishTakeCard = true;
            this.Cards[index]     = 1;
            player.PlayerDetail.AddGold(value);
            player.PlayerDetail.AddMoney(num);
            player.PlayerDetail.LogAddMoney(AddMoneyType.Award, AddMoneyType.Award_TakeCard, player.PlayerDetail.PlayerCharacter.ID, num, player.PlayerDetail.PlayerCharacter.Money);
            player.PlayerDetail.AddGiftToken(value2);
            base.SendGamePlayerTakeCard(player, index, num3, count, false);
            return(true);
        }
Exemplo n.º 3
0
        public override bool TakeCard(Player player, int index)
        {
            if (player.CanTakeOut == 0)
            {
                return(false);
            }

            if (player.IsActive == false || index < 0 || index > Cards.Length || player.FinishTakeCard || Cards[index] > 0)
            {
                return(false);
            }

            int             gold       = 0;
            int             money      = 0;
            int             giftToken  = 0;
            int             medal      = 0;
            int             templateID = 0;
            List <ItemInfo> infos      = null;

            if (DropInventory.CardDrop(RoomType, ref infos))
            {
                if (infos != null)
                {
                    foreach (ItemInfo info in infos)
                    {
                        ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken, ref medal); //trminhpc
                        if (info != null)
                        {
                            templateID = info.TemplateID;
                            player.PlayerDetail.AddTemplate(info, eBageType.TempBag, info.Count);
                        }
                    }
                }
            }
            if (RoomType == eRoomType.Dungeon)
            {
                player.CanTakeOut--;
                if (player.CanTakeOut == 0)
                {
                    player.FinishTakeCard = true;
                }
            }
            else
            {
                player.FinishTakeCard = true;
            }
            Cards[index] = 1;

            int count = 0;

            switch (templateID)
            {
            case -100:
                count = gold;
                break;

            case 0:
                templateID = -100;
                count      = 500;
                break;

            case -300:
                count = giftToken;
                break;

            case -200:
                count = money;
                break;
            }
            player.PlayerDetail.AddGold(gold);
            player.PlayerDetail.AddMoney(money);
            player.PlayerDetail.LogAddMoney(AddMoneyType.Award, AddMoneyType.Award_BossDrop, player.PlayerDetail.PlayerCharacter.ID, money, player.PlayerDetail.PlayerCharacter.Money);
            player.PlayerDetail.AddGiftToken(giftToken);
            player.PlayerDetail.AddMedal(medal); //trminhpc
            //SendGamePlayerTakeCard(player, index, medal, gold, money, giftToken);
            SendGamePlayerTakeCard(player, index, templateID, count, false);
            return(true);
        }
Exemplo n.º 4
0
        public override bool TakeCard(Player player, int index, bool isSysTake)
        {
            bool result;

            if (player.CanTakeOut == 0)
            {
                result = false;
            }
            else
            {
                if (!player.IsActive || index < 0 || index > this.Cards.Length || player.FinishTakeCard || this.Cards[index] > 0)
                {
                    result = false;
                }
                else
                {
                    player.CanTakeOut--;
                    int             gold       = 0;
                    int             money      = 0;
                    int             giftToken  = 0;
                    int             templateID = 0;
                    List <ItemInfo> infos      = null;
                    if (DropInventory.CardDrop(base.RoomType, ref infos))
                    {
                        if (infos != null)
                        {
                            foreach (ItemInfo info in infos)
                            {
                                templateID = info.Template.TemplateID;
                                ItemInfo tempInfo = ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken);
                                if (tempInfo != null && templateID > 0)
                                {
                                    player.PlayerDetail.AddTemplate(tempInfo, eBageType.TempBag, info.Count);
                                }
                            }
                        }
                    }
                    player.FinishTakeCard = true;
                    this.Cards[index]     = 1;
                    int count = 0;
                    int num   = templateID;
                    if (num <= -200)
                    {
                        if (num != -300)
                        {
                            if (num == -200)
                            {
                                count = money;
                            }
                        }
                        else
                        {
                            count = giftToken;
                        }
                    }
                    else
                    {
                        if (num != -100)
                        {
                            if (num == 0)
                            {
                                templateID = -100;
                                count      = 500;
                            }
                        }
                        else
                        {
                            count = gold;
                        }
                    }
                    player.PlayerDetail.AddGold(gold);
                    player.PlayerDetail.AddMoney(money, LogMoneyType.Award, LogMoneyType.Award_TakeCard);
                    player.PlayerDetail.AddGiftToken(giftToken);
                    base.SendGamePlayerTakeCard(player, index, templateID, count, isSysTake);
                    result = true;
                }
            }
            return(result);
        }