Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private static bool Load(Dictionary <string, int> ally)
        {
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                string key;
                ConsortiaAllyInfo[] infos = db.GetConsortiaAllyAll();
                foreach (ConsortiaAllyInfo info in infos)
                {
                    if (!info.IsExist)
                    {
                        continue;
                    }

                    if (info.Consortia1ID < info.Consortia2ID)
                    {
                        key = info.Consortia1ID + "&" + info.Consortia2ID;
                    }
                    else
                    {
                        key = info.Consortia2ID + "&" + info.Consortia1ID;
                    }

                    if (!ally.ContainsKey(key))
                    {
                        ally.Add(key, info.State);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                int    id     = packet.ReadInt();
                bool   result = false;
                string msg    = "ConsortiaDutyDeleteHandler.Failed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    if (db.DeleteConsortiaDuty(id, player.PlayerCharacter.ID, player.PlayerCharacter.ConsortiaID, ref msg))
                    {
                        msg    = "ConsortiaDutyDeleteHandler.Success";
                        result = true;
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
        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);
        }
Exemplo n.º 7
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);
        }
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                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, player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, isBanChat, ref userID, ref userName, ref msg))
                    {
                        msg    = "ConsortiaIsBanChatHandler.Success";
                        result = true;
                        GameServer.Instance.LoginServer.SendConsortiaBanChat(userID, userName, player.PlayerCharacter.ID, player.PlayerCharacter.NickName, isBanChat);
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
Exemplo n.º 9
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                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, player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, upGrade, ref msg, ref info, ref tempUserName))
                    {
                        msg    = "ConsortiaUserGradeUpdateHandler.Success";
                        result = true;
                        GameServer.Instance.LoginServer.SendConsortiaDuty(info, upGrade ? 6 : 7, player.PlayerCharacter.ConsortiaID, id, tempUserName, player.PlayerCharacter.ID, player.PlayerCharacter.NickName);
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
Exemplo n.º 10
0
 private static bool Load(Dictionary <string, int> ally)
 {
     using (ConsortiaBussiness db = new ConsortiaBussiness())
     {
         ConsortiaAllyInfo[] infos = db.GetConsortiaAllyAll();
         ConsortiaAllyInfo[] array = infos;
         for (int i = 0; i < array.Length; i++)
         {
             ConsortiaAllyInfo info = array[i];
             if (info.IsExist)
             {
                 string key;
                 if (info.Consortia1ID < info.Consortia2ID)
                 {
                     key = info.Consortia1ID + "&" + info.Consortia2ID;
                 }
                 else
                 {
                     key = info.Consortia2ID + "&" + info.Consortia1ID;
                 }
                 if (!ally.ContainsKey(key))
                 {
                     ally.Add(key, info.State);
                 }
             }
         }
     }
     return(true);
 }
        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);
        }
Exemplo n.º 12
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            string description = packet.ReadString();

            if (System.Text.Encoding.Default.GetByteCount(description) > 300)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDescriptionUpdateHandler.Long"));
                return(1);
            }
            bool   result = false;
            string msg    = "ConsortiaDescriptionUpdateHandler.Failed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsortiaDescription(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, description, ref msg))
                {
                    msg    = "ConsortiaDescriptionUpdateHandler.Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return(0);
        }
Exemplo n.º 13
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 1;
            }
            else
            {
                bool   state  = packet.ReadBoolean();
                bool   result = false;
                string msg    = "CONSORTIA_APPLY_STATE.Failed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    if (db.UpdateConsotiaApplyState(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, state, ref msg))
                    {
                        msg    = "CONSORTIA_APPLY_STATE.Success";
                        result = true;
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                int    id       = packet.ReadInt();
                bool   result   = false;
                string nickName = "";
                string msg      = (id == player.PlayerCharacter.ID) ? "ConsortiaUserDeleteHandler.ExitFailed" : "ConsortiaUserDeleteHandler.KickFailed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    if (db.DeleteConsortiaUser(player.PlayerCharacter.ID, id, player.PlayerCharacter.ConsortiaID, ref msg, ref nickName))
                    {
                        msg = ((id == player.PlayerCharacter.ID) ? "ConsortiaUserDeleteHandler.ExitSuccess" : "ConsortiaUserDeleteHandler.KickSuccess");
                        int consortiaID = player.PlayerCharacter.ConsortiaID;
                        if (id == player.PlayerCharacter.ID)
                        {
                            player.ClearConsortia(true);
                        }
                        GameServer.Instance.LoginServer.SendConsortiaUserDelete(id, consortiaID, id != player.PlayerCharacter.ID, nickName, player.PlayerCharacter.NickName);
                        result = true;
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
Exemplo n.º 15
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(0);
            }


            bool   result = false;
            string msg    = "ConsortiaShopUpGradeHandler.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 = "ConsortiaShopUpGradeHandler.NoConsortia";
            }
            else
            {
                using (ConsortiaBussiness cb = new ConsortiaBussiness())
                {
                    if (cb.UpGradeShopConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                    {
                        info.ShopLevel++;
                        GameServer.Instance.LoginServer.SendConsortiaShopUpGrade(info);
                        msg    = "ConsortiaShopUpGradeHandler.Success";
                        result = true;
                    }
                }
            }
            if (info.ShopLevel >= 2)
            {
                string msg1 = LanguageMgr.GetTranslation("ConsortiaShopUpGradeHandler.Notice", client.Player.PlayerCharacter.ConsortiaName, info.ShopLevel);

                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);
        }
        public static void Process(IHttpRequest Request, IHttpResponse Response)
        {
            bool     value   = false;
            string   message = "Fail!";
            XElement result  = new XElement("Result");
            int      total   = 0;

            try
            {
                int page     = int.Parse(Request.Uri.QueryString["page"]);
                int size     = int.Parse(Request.Uri.QueryString["size"]);
                int order    = int.Parse(Request.Uri.QueryString["order"]);
                int userID   = int.Parse(Request.Uri.QueryString["userID"]);
                int inviteID = int.Parse(Request.Uri.QueryString["inviteID"]);
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInviteUserInfo[] infos = db.GetConsortiaInviteUserPage(page, size, ref total, order, userID, inviteID);
                    ConsortiaInviteUserInfo[] array = infos;
                    for (int i = 0; i < array.Length; i++)
                    {
                        ConsortiaInviteUserInfo info = array[i];
                        result.Add(FlashUtils.CreateConsortiaInviteUserInfo(info));
                    }
                    value   = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
            }
            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("vaule", value));
            result.Add(new XAttribute("message", message));
            Response.Write(result.ToString(false));
        }
Exemplo n.º 17
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            string placard = packet.ReadString();
            int    result2;

            if (Encoding.Default.GetByteCount(placard) > 300)
            {
                player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaPlacardUpdateHandler.Long", new object[0]));
                result2 = 1;
            }
            else
            {
                bool   result = false;
                string msg    = "ConsortiaPlacardUpdateHandler.Failed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    if (db.UpdateConsortiaPlacard(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, placard, ref msg))
                    {
                        msg    = "ConsortiaPlacardUpdateHandler.Success";
                        result = true;
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
Exemplo n.º 18
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                bool          result = false;
                string        msg    = "ConsortiaSmithUpGradeHandler.Failed";
                ConsortiaInfo info   = ConsortiaMgr.FindConsortiaInfo(player.PlayerCharacter.ConsortiaID);
                if (info == null)
                {
                    msg = "ConsortiaSmithUpGradeHandler.NoConsortia";
                }
                else
                {
                    using (ConsortiaBussiness cb = new ConsortiaBussiness())
                    {
                        if (cb.UpGradeSmithConsortia(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, ref msg))
                        {
                            info.SmithLevel++;
                            GameServer.Instance.LoginServer.SendConsortiaSmithUpGrade(info);
                            msg    = "ConsortiaSmithUpGradeHandler.Success";
                            result = true;
                        }
                    }
                }
                if (info.SmithLevel >= 3 && info.Level <= 10)
                {
                    string msg2 = LanguageMgr.GetTranslation("ConsortiaSmithUpGradeHandler.Notice", new object[]
                    {
                        player.PlayerCharacter.ConsortiaName,
                        info.SmithLevel
                    });
                    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 != player)
                        {
                            p.Out.SendTCP(pkg);
                        }
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 1;
            }
            return(result2);
        }
Exemplo n.º 19
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));
        }
Exemplo n.º 20
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID != 0)
            {
                result2 = 0;
            }
            else
            {
                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, player.PlayerCharacter.ID, player.PlayerCharacter.NickName, ref consortiaID, ref consortiaName, ref msg, info, ref tempID, ref tempName, ref consortiaRepute))
                    {
                        player.PlayerCharacter.ConsortiaID   = consortiaID;
                        player.PlayerCharacter.ConsortiaName = consortiaName;
                        player.PlayerCharacter.DutyLevel     = info.Level;
                        player.PlayerCharacter.DutyName      = info.DutyName;
                        player.PlayerCharacter.Right         = info.Right;
                        ConsortiaInfo consotia = ConsortiaMgr.FindConsortiaInfo(consortiaID);
                        if (consotia != null)
                        {
                            player.PlayerCharacter.ConsortiaLevel = consotia.Level;
                        }
                        msg                = "ConsortiaInvitePassHandler.Success";
                        result             = true;
                        info.UserID        = player.PlayerCharacter.ID;
                        info.UserName      = player.PlayerCharacter.NickName;
                        info.Grade         = player.PlayerCharacter.Grade;
                        info.Offer         = player.PlayerCharacter.Offer;
                        info.RichesOffer   = player.PlayerCharacter.RichesOffer;
                        info.RichesRob     = player.PlayerCharacter.RichesRob;
                        info.Win           = player.PlayerCharacter.Win;
                        info.Total         = player.PlayerCharacter.Total;
                        info.Escape        = player.PlayerCharacter.Escape;
                        info.ConsortiaID   = consortiaID;
                        info.ConsortiaName = consortiaName;
                        GameServer.Instance.LoginServer.SendConsortiaUserPass(tempID, tempName, info, true, consortiaRepute, player.PlayerCharacter.UserName, player.PlayerCharacter.FightPower, player.PlayerCharacter.AchievementPoint, player.PlayerCharacter.Honor);
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteInt(consortiaID);
                packet.WriteString(consortiaName);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
Exemplo n.º 21
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;
     }
 }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        protected void ScanConsortiaProc(object sender)
        {
            try
            {
                int startTick = Environment.TickCount;
                if (log.IsInfoEnabled)
                {
                    log.Info("Saving Record...");
                    log.Debug("Save ThreadId=" + Thread.CurrentThread.ManagedThreadId);
                }

                ThreadPriority oldprio = Thread.CurrentThread.Priority;
                Thread.CurrentThread.Priority = ThreadPriority.Lowest;

                string noticeID = "";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    db.ScanConsortia(ref noticeID);
                }
                string[] noticeIDs = noticeID.Split(',');

                foreach (string s in noticeIDs)
                {
                    if (string.IsNullOrEmpty(s))
                    {
                        continue;
                    }

                    GSPacketIn pkg = new GSPacketIn((byte)ePackageType.CONSORTIA_RESPONSE);
                    pkg.WriteByte(2);
                    pkg.WriteInt(int.Parse(s));
                    SendToALL(pkg);
                }

                Thread.CurrentThread.Priority = oldprio;

                startTick = Environment.TickCount - startTick;
                if (log.IsInfoEnabled)
                {
                    log.Info("Scan Consortia complete!");
                }
                if (startTick > 2 * 60 * 1000)
                {
                    log.WarnFormat("Scan all Consortia in {0} ms", startTick);
                }
            }
            catch (Exception e1)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("ScanConsortiaProc", e1);
                }
            }
        }
Exemplo n.º 24
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                int    dutyID     = packet.ReadInt();
                int    updateType = (int)packet.ReadByte();
                bool   result     = false;
                string msg        = "ConsortiaDutyUpdateHandler.Failed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                    info.ConsortiaID = player.PlayerCharacter.ConsortiaID;
                    info.DutyID      = dutyID;
                    info.IsExist     = true;
                    info.DutyName    = "";
                    switch (updateType)
                    {
                    case 1:
                        result2 = 1;
                        return(result2);

                    case 2:
                        info.DutyName = packet.ReadString();
                        if (string.IsNullOrEmpty(info.DutyName) || Encoding.Default.GetByteCount(info.DutyName) > 10)
                        {
                            player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDutyUpdateHandler.Long", new object[0]));
                            result2 = 1;
                            return(result2);
                        }
                        info.Right = packet.ReadInt();
                        break;
                    }
                    if (db.UpdateConsortiaDuty(info, player.PlayerCharacter.ID, updateType, ref msg))
                    {
                        dutyID = info.DutyID;
                        msg    = "ConsortiaDutyUpdateHandler.Success";
                        result = true;
                        GameServer.Instance.LoginServer.SendConsortiaDuty(info, updateType, player.PlayerCharacter.ConsortiaID);
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteInt(dutyID);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
        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();
            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);
        }
Exemplo n.º 27
0
 protected void ScanConsortiaProc(object sender)
 {
     try
     {
         int num = Environment.TickCount;
         if (CenterServer.log.IsInfoEnabled)
         {
             CenterServer.log.Info("Saving Record...");
             CenterServer.log.Debug("Save ThreadId=" + Thread.CurrentThread.ManagedThreadId);
         }
         ThreadPriority priority = Thread.CurrentThread.Priority;
         Thread.CurrentThread.Priority = ThreadPriority.Lowest;
         string text = "";
         using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
         {
             consortiaBussiness.ScanConsortia(ref text);
         }
         string[] array = text.Split(new char[]
         {
             ','
         });
         string[] array2 = array;
         for (int i = 0; i < array2.Length; i++)
         {
             string text2 = array2[i];
             if (!string.IsNullOrEmpty(text2))
             {
                 GSPacketIn gSPacketIn = new GSPacketIn(128);
                 gSPacketIn.WriteByte(2);
                 gSPacketIn.WriteInt(int.Parse(text2));
                 this.SendToALL(gSPacketIn);
             }
         }
         Thread.CurrentThread.Priority = priority;
         num = Environment.TickCount - num;
         if (CenterServer.log.IsInfoEnabled)
         {
             CenterServer.log.Info("Scan Consortia complete!");
         }
         if (num > 120000)
         {
             CenterServer.log.WarnFormat("Scan all Consortia in {0} ms", num);
         }
     }
     catch (Exception exception)
     {
         if (CenterServer.log.IsErrorEnabled)
         {
             CenterServer.log.Error("ScanConsortiaProc", exception);
         }
     }
 }
Exemplo n.º 28
0
        public void ProcessRequest(HttpContext context)
        {
            bool     value   = false;
            string   message = "Fail!";
            XElement result  = new XElement("Result");
            int      total   = 0;

            try
            {
                //page=1&
                //level=%2D1&
                //ConsortiaID=4&
                //openApply=%2D1&
                //size=1&
                //name=&
                //key=f231292ae606ad5b61fafa816805f47c&
                //order=%2D1&
                //selfid=5&
                //rnd=0%2E6236354559659958
                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)));
        }
Exemplo n.º 29
0
        public static int ConsortiaFight(int consortiaWin, int consortiaLose, Dictionary <int, Player> players, eRoomType roomType, eGameType gameClass, int totalKillHealth, int playercount)
        {
            if (roomType != eRoomType.Match)
            {
                return(0);
            }
            int num   = playercount / 2;
            int num2  = 0;
            int state = 2;
            int num3  = 1;
            int num4  = 3;

            if (gameClass == eGameType.Guild)
            {
                num4 = 10;
                num3 = (int)RateMgr.GetRate(eRateType.Offer_Rate);
            }
            float rate = RateMgr.GetRate(eRateType.Riches_Rate);

            using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
            {
                if (gameClass == eGameType.Free)
                {
                    num = 0;
                }
                else
                {
                    consortiaBussiness.ConsortiaFight(consortiaWin, consortiaLose, num, out num2, state, totalKillHealth, rate);
                }
                foreach (KeyValuePair <int, Player> current in players)
                {
                    if (current.Value != null)
                    {
                        if (current.Value.PlayerDetail.PlayerCharacter.ConsortiaID == consortiaWin)
                        {
                            current.Value.PlayerDetail.AddOffer((num + num4) * num3);
                            current.Value.PlayerDetail.PlayerCharacter.RichesRob += num2;
                        }
                        else
                        {
                            if (current.Value.PlayerDetail.PlayerCharacter.ConsortiaID == consortiaLose)
                            {
                                current.Value.PlayerDetail.AddOffer((int)Math.Round((double)num * 0.5) * num3);
                                current.Value.PlayerDetail.RemoveOffer(num4);
                            }
                        }
                    }
                }
            }
            return(num2);
        }
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                int money = packet.ReadInt();
                if (player.PlayerCharacter.HasBagPassword && player.PlayerCharacter.IsLocked)
                {
                    player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0]));
                    result2 = 1;
                }
                else
                {
                    if (money < 1 || player.PlayerCharacter.Money < money)
                    {
                        player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaRichesOfferHandler.NoMoney", new object[0]));
                        result2 = 1;
                    }
                    else
                    {
                        bool   result = false;
                        string msg    = "ConsortiaRichesOfferHandler.Failed";
                        using (ConsortiaBussiness db = new ConsortiaBussiness())
                        {
                            int riches = money * 100;
                            if (db.ConsortiaRichAdd(player.PlayerCharacter.ConsortiaID, ref riches, 5, player.PlayerCharacter.NickName))
                            {
                                result = true;
                                player.PlayerCharacter.RichesOffer += riches;
                                player.RemoveMoney(money, LogMoneyType.Consortia, LogMoneyType.Consortia_Rich);
                                player.OnPlayerAddItem("RichesOffer", riches);
                                msg = "ConsortiaRichesOfferHandler.Successed";
                                GameServer.Instance.LoginServer.SendConsortiaRichesOffer(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, player.PlayerCharacter.NickName, riches);
                            }
                        }
                        packet.WriteBoolean(result);
                        packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                        player.Out.SendTCP(packet);
                        result2 = 0;
                    }
                }
            }
            return(result2);
        }
Exemplo n.º 31
0
        ///// <summary>
        /////查找商品
        ///// </summary>
        ///// <param name="shopID"></param>
        ///// <param name="itemID"></param>
        ///// <returns></returns>
        //public static bool FindShop(int GoodsID)
        //{
        //    if (m_shop.ContainsKey(GoodsID))
        //    {
        //        return true;
        //    }
        //    return false;
        //}
        /// <summary>
        /// 判断玩家是否可以购买此商品
        /// </summary>
        /// <param name="shopID"></param>
        /// <param name="ItemID"></param>
        /// <param name="isBinds"></param>
        /// <param name="player"></param>
        /// <returns></returns>
        public static bool CanBuy(int shopID, int consortiaShopLevel, ref bool isBinds, int cousortiaID, int playerRiches)
        {
            bool result = false;
            ConsortiaEquipControlInfo cecInfo = null;
            using (ConsortiaBussiness csbs = new ConsortiaBussiness())
            {

                switch (shopID)
                {
                    case 1:                            //普通
                        result = true;
                        isBinds = false;
                        break;
                    case 2:                            //战斗商城
                        result = true;
                        isBinds = false;
                        break;
                    case 3:                            //礼券
                        result = true;
                        isBinds = false;
                        break;
                    case 4:                            //牌子
                        result = true;
                        isBinds = false;
                        break;
                    case 11:
                        cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 1, 1);
                        if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                        {
                            result = true;
                            isBinds = true;
                        }
                        break;
                    case 12:
                        cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 2, 1);
                        if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                        {
                            result = true;
                            isBinds = true;
                        }
                        break;
                    case 13:
                        cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 3, 1);
                        if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                        {
                            result = true;
                            isBinds = true;
                        }
                        break;
                    case 14:
                        cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 4, 1);
                        if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                        {
                            result = true;
                            isBinds = true;
                        }
                        break;
                    case 15:
                        cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 5, 1);
                        if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                        {
                            result = true;
                            isBinds = true;
                        }
                        break;
                }
            }
            return result;
        }