public override bool IsCompleted(GamePlayer player)
 {
     bool result=false;
     int tempComp=0;
     using (ConsortiaBussiness db = new ConsortiaBussiness())
     {
         ConsortiaInfo info = db.GetConsortiaSingle(player.PlayerCharacter.ConsortiaID);
         switch (m_info.Para1)
         {
             case 0:  //公会人数
                 tempComp=info.Count;
                 break;
             case 1:  //公会贡献度
                 tempComp=player.PlayerCharacter.RichesOffer+player.PlayerCharacter.RichesRob;
                 break;
             case 2:  //公会铁匠铺等级
                 tempComp=info.SmithLevel;
                 break;
             case 3:  //公会商城等级
                 tempComp=info.ShopLevel;
                 break;
             case 4:  //公会保管箱等级
                 tempComp = info.StoreLevel;
                 break;
             default:
                 break;
         }
         if (tempComp >= m_info.Para2)
         {
             Value = 0;
             result=true;
         }
         return result;
     }
 }
        public void ProcessRequest(HttpContext context)
        {

            bool value = false;
            string message = "Fail!";
            int total = 0;

            XElement result = new XElement("Result");

            try
            {
                int id = int.Parse(context.Request["id"]);

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo info = db.GetConsortiaSingle(id);
                    if (info != null)
                    {
                        result.Add(new XAttribute("Level", info.Level));
                        result.Add(new XAttribute("Repute", info.Repute));
                    }
                }

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaUserInfo[] infos = db.GetConsortiaUsersPage(1, 1000, ref total, -1, id, -1,-1);
                    foreach (ConsortiaUserInfo info in infos)
                    {
                        result.Add(FlashUtils.CreateConsortiaIMInfo(info));
                    }

                    value = true;
                    message = "Success!";
                }

            }
            catch (Exception ex)
            {
                log.Error("ConsortiaIMList", ex);
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            context.Response.Write(result.ToString(false));
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int bagType = packet.ReadByte();
            int place = packet.ReadInt();

            bool result = false;
            string msg = "ConsortiaUpGradeHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaInfo info = db.GetConsortiaSingle(client.Player.PlayerCharacter.ConsortiaID);
                if (info == null)
                {
                    msg = "ConsortiaUpGradeHandler.NoConsortia";
                }
                else
                {
                    ConsortiaLevelInfo levelInfo = ConsortiaLevelMgr.FindConsortiaLevelInfo(info.Level + 1);
                    //ItemTemplateInfo temp = ItemMgr.GetSingleGoods(levelInfo.NeedItem);

                    if (levelInfo == null)
                    {
                        msg = "ConsortiaUpGradeHandler.NoUpGrade";
                    }
                    //else if (levelInfo.NeedItem != 0 && client.Player.GetAllItemCount(levelInfo.NeedItem) < 1)
                    //{
                    //    msg = "ConsortiaUpGradeHandler.NoItem";
                    //}
                    else if (levelInfo.NeedGold > client.Player.PlayerCharacter.Gold)
                    {
                        msg = "ConsortiaUpGradeHandler.NoGold";
                    }
                    else
                    {
                        using (ConsortiaBussiness cb = new ConsortiaBussiness())
                        {
                            if (cb.UpGradeConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                            {
                                info.Level++;
                                client.Player.RemoveGold(levelInfo.NeedGold);
                                // client.Player.RemoveItemCount(levelInfo.NeedItem, 1);
                                GameServer.Instance.LoginServer.SendConsortiaUpGrade(info);
                                msg = "ConsortiaUpGradeHandler.Success";
                                result = true;
                            }
                        }
                    }
                }
                if (info.Level >= 5)
                {
                    string msg1 = LanguageMgr.GetTranslation("ConsortiaUpGradeHandler.Notice", info.ConsortiaName, info.Level);

                    GSPacketIn pkg = new GSPacketIn((byte)ePackageType.SYS_NOTICE);
                    pkg.WriteInt(2);
                    pkg.WriteString(msg1);

                    GameServer.Instance.LoginServer.SendPacket(pkg);

                    GamePlayer[] players = Game.Server.Managers.WorldMgr.GetAllPlayers();

                    foreach (GamePlayer p in players)
                    {
                        if (p != client.Player && p.PlayerCharacter.ConsortiaID != client.Player.PlayerCharacter.ConsortiaID)
                            p.Out.SendTCP(pkg);
                    }
                }

            }

            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 1;
        }