예제 #1
0
        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));
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        public override bool IsCompleted(GamePlayer player)
        {
            bool flag = false;
            int  num  = 0;
            bool result;

            using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
            {
                ConsortiaInfo consortiaSingle = consortiaBussiness.GetConsortiaSingle(player.PlayerCharacter.ConsortiaID);
                switch (this.m_info.Para1)
                {
                case 0:
                    num = consortiaSingle.Count;
                    break;

                case 1:
                    num = player.PlayerCharacter.RichesOffer + player.PlayerCharacter.RichesRob;
                    break;

                case 2:
                    num = consortiaSingle.SmithLevel;
                    break;

                case 3:
                    num = consortiaSingle.ShopLevel;
                    break;

                case 4:
                    num = consortiaSingle.StoreLevel;
                    break;
                }
                if (num >= this.m_info.Para2)
                {
                    base.Value = 0;
                    flag       = true;
                }
                result = flag;
            }
            return(result);
        }
예제 #4
0
        public override bool IsCompleted(GamePlayer player)
        {
            bool result   = false;
            int  tempComp = 0;
            bool result2;

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaInfo info = db.GetConsortiaSingle(player.PlayerCharacter.ConsortiaID);
                switch (this.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;
                }
                if (tempComp >= this.m_info.Para2)
                {
                    base.Value = 0;
                    result     = true;
                }
                result2 = result;
            }
            return(result2);
        }
예제 #5
0
        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);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int result2;

            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                int    bagType = (int)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);
                        if (levelInfo == null)
                        {
                            msg = "ConsortiaUpGradeHandler.NoUpGrade";
                        }
                        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);
                                        GameServer.Instance.LoginServer.SendConsortiaUpGrade(info);
                                        msg    = "ConsortiaUpGradeHandler.Success";
                                        result = true;
                                    }
                                }
                            }
                        }
                    }
                    if (info.Level >= 5 && info.Level <= 10)
                    {
                        string msg2 = LanguageMgr.GetTranslation("ConsortiaUpGradeHandler.Notice", new object[]
                        {
                            info.ConsortiaName,
                            info.Level
                        });
                        GSPacketIn pkg = new GSPacketIn(10);
                        pkg.WriteInt(2);
                        pkg.WriteString(msg2);
                        GameServer.Instance.LoginServer.SendPacket(pkg);
                        GamePlayer[] players = WorldMgr.GetAllPlayers();
                        GamePlayer[] array   = players;
                        for (int i = 0; i < array.Length; i++)
                        {
                            GamePlayer p = array[i];
                            if (p != client.Player && p.PlayerCharacter.ConsortiaID != client.Player.PlayerCharacter.ConsortiaID)
                            {
                                p.Out.SendTCP(pkg);
                            }
                        }
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                client.Out.SendTCP(packet);
                result2 = 1;
            }
            return(result2);
        }