public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = packet.ReadInt();
            bool result = false;
            string nickName = "";
            string msg = id == client.Player.PlayerCharacter.ID ? "ConsortiaUserDeleteHandler.ExitFailed" : "ConsortiaUserDeleteHandler.KickFailed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.DeleteConsortiaUser(client.Player.PlayerCharacter.ID, id, client.Player.PlayerCharacter.ConsortiaID, ref msg, ref nickName))
                {
                    msg = id == client.Player.PlayerCharacter.ID ? "ConsortiaUserDeleteHandler.ExitSuccess" : "ConsortiaUserDeleteHandler.KickSuccess";
                    int consortiaID = client.Player.PlayerCharacter.ConsortiaID;
                    if (id == client.Player.PlayerCharacter.ID)
                    {
                        client.Player.ClearConsortia();
                        client.Out.SendMailResponse(client.Player.PlayerCharacter.ID, eMailRespose.Receiver);
                    }

                   // client.Player.StoreBag.SendStoreToMail();
                    GameServer.Instance.LoginServer.SendConsortiaUserDelete(id, consortiaID, id != client.Player.PlayerCharacter.ID, nickName,client.Player.PlayerCharacter.NickName);
                    result = true;
                }
            }

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

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int banUserID = packet.ReadInt();
            bool isBanChat = packet.ReadBoolean();
            int userID = 0;
            string userName = "";
            bool result = false;
            string msg = "ConsortiaIsBanChatHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsortiaIsBanChat(banUserID, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, isBanChat, ref userID, ref userName, ref msg))
                {
                    msg = "ConsortiaIsBanChatHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaBanChat(userID, userName, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName,isBanChat);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
Пример #3
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;
     }
 }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;
            //Type 1表示商城,2表示铁匠铺

            bool result = false;
            string msg = "ConsortiaEquipControlHandler.Fail";
            ConsortiaEquipControlInfo info = new ConsortiaEquipControlInfo();
            info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                for (int i = 0; i < 5; i++)
                {

                    info.Riches = packet.ReadInt();
                    info.Type = 1;
                    info.Level = i + 1;

                    db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
                }
                info.Riches = packet.ReadInt();
                info.Type = 2;
                info.Level = 0;
                db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
                msg = "ConsortiaEquipControlHandler.Success";
                result = true;
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = client.Player.PlayerCharacter.ConsortiaID;
            string consortiaName = client.Player.PlayerCharacter.ConsortiaName;
            bool result = false;
            string msg = "ConsortiaDisbandHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.DeleteConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                {
                    result = true;
                    msg = "ConsortiaDisbandHandler.Success1";

                    client.Player.ClearConsortia();

                    GameServer.Instance.LoginServer.SendConsortiaDelete(id);
                }
            }

            string temp = LanguageMgr.GetTranslation(msg);
            if (msg == "ConsortiaDisbandHandler.Success1")
            {
                temp += consortiaName + LanguageMgr.GetTranslation("ConsortiaDisbandHandler.Success2");
            }

            packet.WriteBoolean(result);
            packet.WriteInt(client.Player.PlayerCharacter.ID);
            packet.WriteString(temp);
            client.Out.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = packet.ReadInt();
            bool isAlly = packet.ReadBoolean();
            bool result = false;
            string msg = "ConsortiaApplyAllyAddHandler.Add_Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaApplyAllyInfo info = new ConsortiaApplyAllyInfo();
                info.Consortia1ID = client.Player.PlayerCharacter.ConsortiaID;
                info.Consortia2ID = id;
                info.Date = DateTime.Now;
                info.State = 0;// isAlly ? 1 : 0;
                info.Remark = "";
                info.IsExist = true;
                if (db.AddConsortiaApplyAlly(info, client.Player.PlayerCharacter.ID, ref msg))
                {
                    msg = "ConsortiaApplyAllyAddHandler.Add_Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = packet.ReadInt();
            string remark = packet.ReadString();
            if (string.IsNullOrEmpty(remark) || System.Text.Encoding.Default.GetByteCount(remark) > 100)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaUserRemarkHandler.Long"));
                return 1;
            }
            bool result = false;
            string msg = "ConsortiaUserRemarkHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsortiaUserRemark(id, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, remark, ref msg))
                {
                    msg = "ConsortiaUserRemarkHandler.Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID != 0)
                return 0;

            int id = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaApplyLoginHandler.ADD_Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaApplyUserInfo info = new ConsortiaApplyUserInfo();
                info.ApplyDate = DateTime.Now;
                info.ConsortiaID = id;
                info.ConsortiaName = "";
                info.IsExist = true;
                info.Remark = "";
                info.UserID = client.Player.PlayerCharacter.ID;
                info.UserName = client.Player.PlayerCharacter.NickName;
                if (db.AddConsortiaApplyUsers(info, ref msg))
                {
                    msg = id != 0 ? "ConsortiaApplyLoginHandler.ADD_Success" : "ConsortiaApplyLoginHandler.DELETE_Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaApplyLoginPassHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                int consortiaRepute = 0;
                ConsortiaUserInfo info = new ConsortiaUserInfo();
                if (db.PassConsortiaApplyUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ConsortiaID, ref msg, info, ref consortiaRepute))
                {
                    msg = "ConsortiaApplyLoginPassHandler.Success";
                    result = true;
                    if (info.UserID != 0)
                    {
                        info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
                        info.ConsortiaName = client.Player.PlayerCharacter.ConsortiaName;
                        GameServer.Instance.LoginServer.SendConsortiaUserPass(client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, info, false, consortiaRepute, info.LoginName, client.Player.PlayerCharacter.FightPower);
                    }
                }
            }

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

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = packet.ReadInt();
            bool upGrade = packet.ReadBoolean();
            bool result = false;
            string msg = "ConsortiaUserGradeUpdateHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                string tempUserName = "";
                ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                if (db.UpdateConsortiaUserGrade(id, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, upGrade, ref msg, ref info, ref tempUserName))
                {
                    msg = "ConsortiaUserGradeUpdateHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaDuty(info, upGrade ? 6 : 7, client.Player.PlayerCharacter.ConsortiaID,id, tempUserName,client.Player.PlayerCharacter.ID,client.Player.PlayerCharacter.NickName);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public static string Bulid(HttpContext context)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");

            try
            {
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaLevelInfo[] infos = db.GetAllConsortiaLevel();
                    foreach (ConsortiaLevelInfo info in infos)
                    {
                        result.Add(Road.Flash.FlashUtils.CreateConsortiLevelInfo(info));
                    }
                }

                value = true;
                message = "Success!";
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaLevelList", ex);
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            return csFunction.CreateCompressXml(context, result, "ConsortiaLevelList", true);
            //return result.ToString(false);
        }
Пример #12
0
        public static string BuildCelebConsortia(string file, int order, string fileNotCompress)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = 1;
                int size = 50;
                //int order = 10;
                int consortiaID = -1;
                string name = "";
                int level = -1;

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo[] infos = db.GetConsortiaPage(page, size, ref total, order, name, consortiaID, level,-1);
                    foreach (ConsortiaInfo info in infos)
                    {
                        XElement node = FlashUtils.CreateConsortiaInfo(info);

                        if (info.ChairmanID != 0)
                        {
                            using (PlayerBussiness pb = new PlayerBussiness())
                            {
                                PlayerInfo player = pb.GetUserSingleByUserID(info.ChairmanID);
                                if (player != null)
                                {
                                    node.Add(FlashUtils.CreateCelebInfo(player));
                                }
                            }
                        }
                        result.Add(node);
                    }

                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error(file + " is fail!", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            result.Add(new XAttribute("date", System.DateTime.Today.ToString("yyyy-MM-dd")));

            if (!string.IsNullOrEmpty(fileNotCompress))
            {
                csFunction.CreateCompressXml(result, fileNotCompress, false);
            }

            return csFunction.CreateCompressXml(result, file, true);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;


            bool result = false;
            string msg = "ConsortiaSmithUpGradeHandler.Failed";

            //using (ConsortiaBussiness db = new ConsortiaBussiness())
            //{
            //    ConsortiaInfo info = db.GetConsortiaSingle(client.Player.PlayerCharacter.ConsortiaID);
            ConsortiaInfo info = Managers.ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
            if (info == null)
            {
                msg = "ConsortiaSmithUpGradeHandler.NoConsortia";
            }
            else
            {
                using (ConsortiaBussiness cb = new ConsortiaBussiness())
                {
                    if (cb.UpGradeSmithConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                    {
                        info.SmithLevel++;
                        GameServer.Instance.LoginServer.SendConsortiaSmithUpGrade(info);
                        msg = "ConsortiaSmithUpGradeHandler.Success";
                        result = true;
                    }
                }
            }
            if (info.SmithLevel >= 3)
            {
                string msg1 = LanguageMgr.GetTranslation("ConsortiaSmithUpGradeHandler.Notice", client.Player.PlayerCharacter.ConsortiaName, info.SmithLevel);

                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.Out.SendTCP(pkg);
                }
            }
            //}


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


            return 1;
        }
Пример #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {

                //int riches;
                //db.ConsortiaFight(37, 58, 4, out riches, 0);
                //int a = riches;
            }
        }
Пример #15
0
        public void ProcessRequest(HttpContext context)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = int.Parse(context.Request["page"]);
                int size = int.Parse(context.Request["size"]);
                int order = int.Parse(context.Request["order"]);
                int consortiaID = int.Parse(context.Request["consortiaID"]);
                int state = int.Parse(context.Request["state"]);
                string name = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["name"] == null ? "" : context.Request["name"]));

                //List<int> list = new List<int>();
                //if (state == 0 || state == 2)
                //{
                //    using (ConsortiaBussiness db = new ConsortiaBussiness())
                //    {
                //        list.AddRange(db.GetConsortiaByAllyByState(consortiaID, state == 0 ? 1 : 0));

                //    }
                //}
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaAllyInfo[] infos = db.GetConsortiaAllyPage(page, size, ref total, order, consortiaID, state,name);
                    foreach (ConsortiaAllyInfo info in infos)
                    {
                        //if (list.Contains(info.Consortia1ID))
                        //{
                        //    info.IsApply = true;
                        //}
                        result.Add(FlashUtils.CreateConsortiaAllyInfo(info));
                    }

                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaAllyList", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID != 0)
                return 0;

            int id = packet.ReadInt();
            bool result = false;
            int consortiaID = 0;
            string consortiaName = "";
            string msg = "ConsortiaInvitePassHandler.Failed";
            int tempID = 0;
            string tempName = "";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                int consortiaRepute = 0;
                ConsortiaUserInfo info = new ConsortiaUserInfo();
                if (db.PassConsortiaInviteUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, ref consortiaID, ref consortiaName, ref msg, info, ref tempID, ref tempName, ref consortiaRepute))
                {
                    client.Player.PlayerCharacter.ConsortiaID = consortiaID;
                    client.Player.PlayerCharacter.ConsortiaName = consortiaName;
                    client.Player.PlayerCharacter.DutyLevel = info.Level;
                    client.Player.PlayerCharacter.DutyName = info.DutyName;
                    client.Player.PlayerCharacter.Right = info.Right;
                    ConsortiaInfo consotia = ConsortiaMgr.FindConsortiaInfo(consortiaID);
                    if (consotia != null)
                        client.Player.PlayerCharacter.ConsortiaLevel = consotia.Level;
                    msg = "ConsortiaInvitePassHandler.Success";
                    result = true;

                    info.UserID = client.Player.PlayerCharacter.ID;
                    info.UserName = client.Player.PlayerCharacter.NickName;
                    info.Grade = client.Player.PlayerCharacter.Grade;
                    info.Offer = client.Player.PlayerCharacter.Offer;
                    info.RichesOffer = client.Player.PlayerCharacter.RichesOffer;
                    info.RichesRob = client.Player.PlayerCharacter.RichesRob;
                    info.Win = client.Player.PlayerCharacter.Win;
                    info.Total = client.Player.PlayerCharacter.Total;
                    info.Escape = client.Player.PlayerCharacter.Escape;
                    info.ConsortiaID = consortiaID;
                    info.ConsortiaName = consortiaName;

                    GameServer.Instance.LoginServer.SendConsortiaUserPass(tempID, tempName, info, true, consortiaRepute, client.Player.PlayerCharacter.UserName, client.Player.PlayerCharacter.FightPower);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteInt(consortiaID);
            packet.WriteString(consortiaName);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
           

            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

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

               
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    for (int i = 1; i < 3;i++ )
                    {
                        for (int j = 1; j < 11; j++) 
                        {
                            ConsortiaEquipControlInfo cecInfo = db.GetConsortiaEuqipRiches(consortiaID, j,i);
                            if (cecInfo != null)
                            {
                                result.Add(new XElement("Item", new XAttribute("type", cecInfo.Type), new XAttribute("level", cecInfo.Level), new XAttribute("riches", cecInfo.Riches)));
                                total++;
                            }
                            
                        }
                    }
             
                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaEventList", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("vaule", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));



           
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int dutyID = packet.ReadInt();
            int updateType = packet.ReadByte();
            //int level = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaDutyUpdateHandler.Failed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
                info.DutyID = dutyID;
                info.IsExist = true;
                info.DutyName = "";
                switch (updateType)
                {
                    case 1:
                        return 1;
                    case 2:
                        info.DutyName = packet.ReadString();
                        if (string.IsNullOrEmpty(info.DutyName) || System.Text.Encoding.Default.GetByteCount(info.DutyName) > 10)
                        {
                            client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDutyUpdateHandler.Long"));
                            return 1;
                        }
                        info.Right = packet.ReadInt();
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                }

                if (db.UpdateConsortiaDuty(info, client.Player.PlayerCharacter.ID, updateType, ref msg))
                {
                    dutyID = info.DutyID;
                    msg = "ConsortiaDutyUpdateHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaDuty(info, updateType, client.Player.PlayerCharacter.ConsortiaID);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteInt(dutyID);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            //int id = packet.ReadInt();
            string nickName = packet.ReadString();
            bool result = false;
            string msg = "ConsortiaChangeChairmanHandler.Failed";

            if (string.IsNullOrEmpty(nickName))
            {
                msg = "ConsortiaChangeChairmanHandler.NoName";
            }
            else if( nickName == client.Player.PlayerCharacter.NickName)
            {
                msg = "ConsortiaChangeChairmanHandler.Self";
            }
            else
            {
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    string tempUserName = "";
                    int tempUserID = 0;
                    ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                    if (db.UpdateConsortiaChairman(nickName, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg, ref info,ref tempUserID, ref tempUserName))
                    {
                        ConsortiaDutyInfo orderInfo = new ConsortiaDutyInfo();
                        orderInfo.Level = client.Player.PlayerCharacter.DutyLevel;
                        orderInfo.DutyName = client.Player.PlayerCharacter.DutyName;
                        orderInfo.Right = client.Player.PlayerCharacter.Right;
                        msg = "ConsortiaChangeChairmanHandler.Success1";
                        result = true;
                        GameServer.Instance.LoginServer.SendConsortiaDuty(orderInfo, 9, client.Player.PlayerCharacter.ConsortiaID, tempUserID, tempUserName, 0, "");
                        GameServer.Instance.LoginServer.SendConsortiaDuty(info, 8, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, 0, "");
                    }
                }
            }
            string temp = LanguageMgr.GetTranslation(msg);
            if (msg == "ConsortiaChangeChairmanHandler.Success1")
            {
                temp += nickName + LanguageMgr.GetTranslation("ConsortiaChangeChairmanHandler.Success2");
            }

            packet.WriteBoolean(result);
            packet.WriteString(temp);
            client.Out.SendTCP(packet);

            return 0;
        }
Пример #20
0
        private static bool Load(Dictionary<int, ConsortiaLevelInfo> consortiaLevel)
        {
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaLevelInfo[] infos = db.GetAllConsortiaLevel();
                foreach (ConsortiaLevelInfo info in infos)
                {
                    if (!consortiaLevel.ContainsKey(info.Level))
                    {
                        consortiaLevel.Add(info.Level, info);
                    }
                }
            }

            return true;
        }
Пример #21
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));
        }
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     int id = packet.ReadInt();
     bool result = false;
     string msg = "ConsortiaApplyAllyDeleteHandler.Failed";
     using (ConsortiaBussiness db = new ConsortiaBussiness())
     {              
         if (db.DeleteConsortiaApplyUsers(id,client.Player.PlayerCharacter.ID,client.Player.PlayerCharacter.ConsortiaID,ref msg))
         {
             msg = client.Player.PlayerCharacter.ID == 0 ? "ConsortiaApplyAllyDeleteHandler.Success" : "ConsortiaApplyAllyDeleteHandler.Success2";
             result = true;
         }
     }
     packet.WriteBoolean(result);
     packet.WriteString(LanguageMgr.GetTranslation(msg));
     client.Out.SendTCP(packet);
     return 0;
 }
Пример #23
0
        public void ProcessRequest(HttpContext context)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = int.Parse(context.Request["page"]);
                int size = int.Parse(context.Request["size"]);
                int order = int.Parse(context.Request["order"]);
                int consortiaID = int.Parse(context.Request["consortiaID"]);
                string name = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["name"]));
                int level = int.Parse(context.Request["level"]);
                //-1表示全部,1开启的,0关闭的。
                int openApply = int.Parse(context.Request["openApply"]);

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo[] infos = db.GetConsortiaPage(page,size,ref total,order, name, consortiaID, level,openApply);
                    foreach (ConsortiaInfo info in infos)
                    {
                        result.Add(FlashUtils.CreateConsortiaInfo(info));
                    }

                    value = true;
                    message = "Success!";
                    
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaList", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false)));
        }
        public void ProcessRequest(HttpContext context)
        {
            LanguageMgr.Setup(ConfigurationManager.AppSettings["ReqPath"]);
            bool value = false;
            string message = LanguageMgr.GetTranslation("Tank.Request.ConsortiaCheck.Exist");
            XElement result = new XElement("Result");

            try
            {
                string ConsortiaName = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["NickName"]));
                if (System.Text.Encoding.Default.GetByteCount(ConsortiaName) <= 14)
                {
                    if (!string.IsNullOrEmpty(ConsortiaName))
                    {
                        using (ConsortiaBussiness db = new ConsortiaBussiness())
                        {
                            if (db.GetConsortiaSingleByName(ConsortiaName) == null)
                            {
                                value = true;
                                message = LanguageMgr.GetTranslation("Tank.Request.ConsortiaCheck.Right");

                            }
                        }
                    }
                }
                else
                {
                    message = LanguageMgr.GetTranslation("Tank.Request.ConsortiaCheck.Long");
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaCheck", ex);
                value = false;
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int money = packet.ReadInt();
            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {

                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return 1;
            }

            if (money < 1 || client.Player.PlayerCharacter.Money < money)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaRichesOfferHandler.NoMoney"));
                return 1;
            }

            bool result = false;
            string msg = "ConsortiaRichesOfferHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                int riches = money / 2;
                if (db.ConsortiaRichAdd(client.Player.PlayerCharacter.ConsortiaID, ref riches, 5, client.Player.PlayerCharacter.NickName))
                {
                    result = true;
                    client.Player.PlayerCharacter.RichesOffer += riches;
                    //client.Player.SetMoney(-money);

                    client.Player.RemoveMoney(money);
                    LogMgr.LogMoneyAdd(LogMoneyType.Consortia, LogMoneyType.Consortia_Rich, client.Player.PlayerCharacter.ID, money, client.Player.PlayerCharacter.Money, 0, 0, (int)eSubConsumerType.Consortia_Riches_Offer,0, "", "", "");
                    msg = "ConsortiaRichesOfferHandler.Successed";
                    GameServer.Instance.LoginServer.SendConsortiaRichesOffer(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, riches);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public void ProcessRequest(HttpContext context)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = int.Parse(context.Request["page"]);
                int size = int.Parse(context.Request["size"]);
                int order = int.Parse(context.Request["order"]);
                int consortiaID = int.Parse(context.Request["consortiaID"]);
                int userID = int.Parse(context.Request["userID"]);
                int state = int.Parse(context.Request["state"]);

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaUserInfo[] infos = db.GetConsortiaUsersPage(page, size, ref total, order, consortiaID, userID,state);
                    foreach (ConsortiaUserInfo info in infos)
                    {
                        result.Add(FlashUtils.CreateConsortiaUserInfo(info));
                    }

                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaUsersList", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            result.Add(new XAttribute("currentDate",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
        public void ProcessRequest (HttpContext context)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = 1;// int.Parse(context.Request["page"]);
                int size = 10;// int.Parse(context.Request["size"]);
                int order = 1;//int.Parse(context.Request["order"]);
                int consortiaID = int.Parse(context.Request["consortiaID"]);
                int level = int.Parse(context.Request["level"]);
                int type = int.Parse(context.Request["type"]);

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaEquipControlInfo[] infos = db.GetConsortiaEquipControlPage(page, size, ref total, order, consortiaID, level, type);
                    foreach (ConsortiaEquipControlInfo info in infos)
                    {
                        result.Add(FlashUtils.CreateConsortiaEquipControlInfo(info));
                    }

                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaList", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("vaule", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            bool result = false;
            string msg = "ConsortiaStoreUpGradeHandler.Failed";
            //using (ConsortiaBussiness db = new ConsortiaBussiness())
            //{
            //    ConsortiaInfo info = db.GetConsortiaSingle(client.Player.PlayerCharacter.ConsortiaID);

            ConsortiaInfo info = Managers.ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
            if (info == null)
            {
                msg = "ConsortiaStoreUpGradeHandler.NoConsortia";
            }
            else
            {
                using (ConsortiaBussiness cb = new ConsortiaBussiness())
                {
                    if (cb.UpGradeStoreConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                    {
                        info.StoreLevel++;
                        GameServer.Instance.LoginServer.SendConsortiaStoreUpGrade(info);
                        msg = "ConsortiaStoreUpGradeHandler.Success";
                        result = true;
                    }
                }
            }

            //}


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

            return 1;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int id = packet.ReadInt();
            bool result = false;
            int tempID = 0;
            int state = 0;
            string msg = "ConsortiaApplyAllyPassHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.PassConsortiaApplyAlly(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.ConsortiaID,ref tempID,ref state, ref msg))
                {
                    msg = "ConsortiaApplyAllyPassHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaAlly(client.Player.PlayerCharacter.ConsortiaID, tempID, state);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 1;

            bool state = packet.ReadBoolean();
            bool result = false;
            string msg = "CONSORTIA_APPLY_STATE.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsotiaApplyState(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, state,ref msg))
                {
                    msg = "CONSORTIA_APPLY_STATE.Success";
                    result =true;
                }
            }

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

            return 0;
        }