Exemple #1
0
        public void OpenBox(int boxId)
        {
            Box box = null;

            foreach (Box temp in m_tempBoxes)
            {
                if (temp.Id == boxId && temp.Items != null)
                {
                    box = temp;
                    break;
                }
            }

            if (box != null)
            {
                ItemTemplateInfo temp = ItemMgr.GetSingleGoods(box.Items.GoodsID);
                if (temp != null)
                {
                    if (temp.CategoryID == 10) //如果是道具
                    {
                        if (m_player.PropInventory.AddItemTemplate(temp) == null)
                        {
                            m_player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("Game.Server.SceneGames.TankHandle.PropFull"));
                        }
                    }
                    else
                    {
                        m_player.TempInventory.AddItemTemplate(temp, box.Items);
                    }
                }
                m_tempBoxes.Remove(box);
            }
        }
Exemple #2
0
        public bool TakeCard(Player player, int index)
        {
            if (player.CanTakeOut == false)
            {
                return(false);
            }

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

            MapGoodsInfo info = MapMgr.GetRandomAward(m_map.Info.ID, m_map.Info.Type);

            bool isItem = false;
            int  value  = 100;

            if (info != null)
            {
                if (info.GoodsID > 0)
                {
                    ItemTemplateInfo temp = ItemMgr.GetSingleGoods(info.GoodsID);
                    if (temp != null)
                    {
                        isItem = true;
                        value  = info.GoodsID;
                        player.PlayerDetail.TempInventory.AddItemTemplate(temp, info);
                    }
                }
                else if (info.GoodsID == -1)
                {
                    value = info.Value;
                }
            }

            if (isItem == false)
            {
                value = player.PlayerDetail.AddGold(value);
            }

            player.HasTakeCard = true;
            Cards[index]       = 1;

            GSPacketIn pkg = player.PlayerDetail.Out.SendGamePlayerTakeCard(player, index, isItem, value);

            SendToAll(pkg, player.PlayerDetail);

            return(true);
        }