コード例 #1
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.MarryInfoID != 0)
            {
                return 1;
            }
            
            bool IsPublishEquip = packet.ReadBoolean();
            string Introduction = packet.ReadString();
            int UserID = client.Player.PlayerCharacter.ID;
            eMessageType eMsg = eMessageType.Normal;
            string msg = "MarryInfoAddHandler.Fail";

            int needGold = 10000;
            if (needGold > client.Player.PlayerCharacter.Gold)
            {
                eMsg = eMessageType.ERROR;
                msg = "MarryInfoAddHandler.Msg1";
            }
            else
            {
                client.Player.SaveIntoDatabase();
                MarryInfo info = new MarryInfo();
                info.UserID = UserID;
                info.IsPublishEquip = IsPublishEquip;
                info.Introduction = Introduction;
                info.RegistTime = DateTime.Now;

                using (PlayerBussiness db = new PlayerBussiness())
                {
                    if (db.AddMarryInfo(info))
                    {
                        client.Player.RemoveGold(needGold);
                        msg = "MarryInfoAddHandler.Msg2";
                        client.Player.PlayerCharacter.MarryInfoID = info.ID;
                        client.Out.SendMarryInfoRefresh(info, info.ID, true);
                    }
                }
            }


            client.Out.SendMessage(eMsg, LanguageMgr.GetTranslation(msg));

            return 0;
        }
コード例 #2
0
 public GSPacketIn SendMarryInfoRefresh(MarryInfo info, int ID, bool isExist)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.MARRYINFO_REFRESH);
     pkg.WriteInt(ID);
     pkg.WriteBoolean(isExist);
     if (isExist)
     {
         pkg.WriteInt(info.UserID);
         pkg.WriteBoolean(info.IsPublishEquip);
         pkg.WriteString(info.Introduction);
     }
     SendTCP(pkg);
     return pkg;
 }
コード例 #3
0
 public GSPacketIn SendMarryInfo(GamePlayer player, MarryInfo info)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.MARRYINFO_GET, player.PlayerCharacter.ID);
     pkg.WriteString(info.Introduction);
     pkg.WriteBoolean(info.IsPublishEquip);
     SendTCP(pkg);
     return pkg;
 }
コード例 #4
0
ファイル: PlayerBussiness.cs プロジェクト: nuinfo/Source
 public bool AddMarryInfo(MarryInfo info)
 {
     bool flag = false;
     try
     {
         SqlParameter[] SqlParameters = new SqlParameter[5];
         SqlParameters[0] = new SqlParameter("@ID", (object)info.ID);
         SqlParameters[0].Direction = ParameterDirection.Output;
         SqlParameters[1] = new SqlParameter("@UserID", (object)info.UserID);
         SqlParameters[2] = new SqlParameter("@IsPublishEquip", (object)(int)(info.IsPublishEquip ? 1 : 0));
         SqlParameters[3] = new SqlParameter("@Introduction", (object)info.Introduction);
         SqlParameters[4] = new SqlParameter("@RegistTime", (object)info.RegistTime);
         flag = this.db.RunProcedure("SP_MarryInfo_Add", SqlParameters);
         info.ID = (int)SqlParameters[0].Value;
     }
     catch (Exception ex)
     {
         if (BaseBussiness.log.IsErrorEnabled)
             BaseBussiness.log.Error((object)"AddMarryInfo", ex);
     }
     return flag;
 }
コード例 #5
0
ファイル: PlayerBussiness.cs プロジェクト: nuinfo/Source
 public bool UpdateMarryInfo(MarryInfo info)
 {
     bool flag = false;
     try
     {
         SqlParameter[] SqlParameters = new SqlParameter[6]
     {
       new SqlParameter("@ID", (object) info.ID),
       new SqlParameter("@UserID", (object) info.UserID),
       new SqlParameter("@IsPublishEquip", (object) (int) (info.IsPublishEquip ? 1 : 0)),
       new SqlParameter("@Introduction", (object) info.Introduction),
       new SqlParameter("@RegistTime", (object) info.RegistTime),
       new SqlParameter("@Result", SqlDbType.Int)
     };
         SqlParameters[5].Direction = ParameterDirection.ReturnValue;
         this.db.RunProcedure("SP_MarryInfo_Update", SqlParameters);
         flag = (int)SqlParameters[5].Value == 0;
     }
     catch (Exception ex)
     {
         if (BaseBussiness.log.IsErrorEnabled)
             BaseBussiness.log.Error((object)"Init", ex);
     }
     return flag;
 }
コード例 #6
0
        //public GSPacketIn SendAASControl(bool result, bool IsAASInfo, bool IsMinor)
        //{
        //    throw new NotImplementedException();
        //}

        public GSPacketIn SendMarryInfoRefresh(SqlDataProvider.Data.MarryInfo info, int ID, bool isExist)
        {
            throw new NotImplementedException();
        }
コード例 #7
0
 public GSPacketIn SendMarryInfo(Game.Server.GameObjects.GamePlayer player, SqlDataProvider.Data.MarryInfo info)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
        public MarryInfo[] GetMarryInfoPage(int page, string name, bool sex, int size, ref int total)
        {
            List<MarryInfo> infos = new List<MarryInfo>();
            //SqlDataReader reader = null;
            try
            {
                string sWhere = "";
                if (sex)
                {
                    sWhere = " IsExist=1 and Sex=1 and UserExist=1";
                }
                else
                {
                    sWhere = " IsExist=1 and Sex=0 and UserExist=1";
                }

                if (!string.IsNullOrEmpty(name))
                {
                    sWhere += " and NickName like '%" + name + "%' ";
                }

                string sOrder = "State desc,IsMarried";
                SqlParameter[] para = new SqlParameter[8];
                para[0] = new SqlParameter("@QueryStr", "V_Sys_Marry_Info");
                para[1] = new SqlParameter("@QueryWhere", sWhere);
                para[2] = new SqlParameter("@PageSize", size);
                para[3] = new SqlParameter("@PageCurrent", page);
                para[4] = new SqlParameter("@FdShow", "*");
                para[5] = new SqlParameter("@FdOrder", sOrder);
                para[6] = new SqlParameter("@FdKey", "ID");
                para[7] = new SqlParameter("@TotalRow", total);
                para[7].Direction = ParameterDirection.Output;
                DataTable dt = db.GetDataTable("V_Sys_Marry_Info", "SP_CustomPage", para);
                total = (int)para[7].Value;
                foreach (DataRow dr in dt.Rows)
                {
                    MarryInfo info = new MarryInfo();
                    info.ID = (int)dr["ID"];
                    info.UserID = (int)dr["UserID"];
                    info.IsPublishEquip = (bool)dr["IsPublishEquip"];
                    info.Introduction = dr["Introduction"].ToString();
                    info.NickName = dr["NickName"].ToString();
                    info.IsConsortia = (bool)dr["IsConsortia"];
                    info.ConsortiaID = (int)dr["ConsortiaID"];
                    info.Sex = (bool)dr["Sex"];
                    info.Win = (int)dr["Win"];
                    info.Total = (int)dr["Total"];
                    info.Escape = (int)dr["Escape"];
                    info.GP = (int)dr["GP"];
                    info.Honor = dr["Honor"].ToString();
                    info.Style = dr["Style"].ToString();
                    info.Colors = dr["Colors"].ToString();
                    info.Hide = (int)dr["Hide"];
                    info.Grade = (int)dr["Grade"];
                    info.State = (int)dr["State"];
                    info.Repute = (int)dr["Repute"];
                    info.Skin = dr["Skin"].ToString();
                    info.Offer = (int)dr["Offer"];
                    info.IsMarried = (bool)dr["IsMarried"];
                    info.ConsortiaName = dr["ConsortiaName"].ToString();
                    info.DutyName = dr["DutyName"].ToString();
                    info.Nimbus = (int)dr["Nimbus"];
                    info.FightPower = (int)dr["FightPower"];
                    infos.Add(info);
                }
                //db.GetReader(ref reader, "SP_CustomPage", para);
                //total = (int)para[7].Value;
                //while (reader.Read())
                //{
                //    infos.Add(InitAuctionInfo(reader));
                //}
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("Init", e);
            }
            finally
            {
                //if (reader != null && !reader.IsClosed)
                //    reader.Close();
            }

            return infos.ToArray();
        }
コード例 #9
0
        public bool UpdateMarryInfo(MarryInfo info)
        {
            bool result = false;
            try
            {
                SqlParameter[] para = new SqlParameter[6];
                para[0] = new SqlParameter("@ID", info.ID);
                para[1] = new SqlParameter("@UserID", info.UserID);
                para[2] = new SqlParameter("@IsPublishEquip", info.IsPublishEquip);
                para[3] = new SqlParameter("@Introduction", info.Introduction);
                para[4] = new SqlParameter("@RegistTime", info.RegistTime);
                para[5] = new SqlParameter("@Result", System.Data.SqlDbType.Int);
                para[5].Direction = ParameterDirection.ReturnValue;

                db.RunProcedure("SP_MarryInfo_Update", para);
                int returnValue = (int)para[5].Value;
                result = returnValue == 0;
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("Init", e);
            }
            return result;
        }
コード例 #10
0
        public MarryInfo GetMarryInfoSingle(int ID)
        {
            SqlDataReader reader = null;
            try
            {
                SqlParameter[] para = new SqlParameter[1];
                para[0] = new SqlParameter("@ID", ID);
                db.GetReader(ref reader, "SP_MarryInfo_Single", para);
                while (reader.Read())
                {
                    MarryInfo info = new MarryInfo();
                    info.ID = (int)reader["ID"];
                    info.UserID = (int)reader["UserID"];
                    info.IsPublishEquip = (bool)reader["IsPublishEquip"];
                    info.Introduction = reader["Introduction"].ToString();
                    info.RegistTime = (DateTime)reader["RegistTime"];
                    //info.Sex = (bool)reader["Sex"];
                    //info.State = (bool)reader["State"];
                    //info.IsMarried = (bool)reader["IsMarried"];
                    return info;
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("GetMarryInfoSingle", e);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }

            return null;
        }
コード例 #11
0
 public bool AddMarryInfo(MarryInfo info)
 {
     bool result = false;
     try
     {
         SqlParameter[] para = new SqlParameter[5];
         para[0] = new SqlParameter("@ID", info.ID);
         para[0].Direction = ParameterDirection.Output;
         para[1] = new SqlParameter("@UserID", info.UserID);
         para[2] = new SqlParameter("@IsPublishEquip", info.IsPublishEquip);
         para[3] = new SqlParameter("@Introduction", info.Introduction);
         para[4] = new SqlParameter("@RegistTime", info.RegistTime);
         result = db.RunProcedure("SP_MarryInfo_Add", para);
         info.ID = (int)para[0].Value;
     }
     catch (Exception e)
     {
         if (log.IsErrorEnabled)
             log.Error("AddMarryInfo", e);
     }
     return result;
 }
コード例 #12
0
ファイル: FlashUtils.cs プロジェクト: vancourt/BaseGunnyII
 public static XElement CreateMarryInfo(MarryInfo info)
 {
     return new XElement("Info", new XAttribute("ID", info.ID),
         new XAttribute("UserID", info.UserID),
         new XAttribute("IsPublishEquip", info.IsPublishEquip),
         new XAttribute("Introduction", info.Introduction),
         new XAttribute("NickName", info.NickName),
         new XAttribute("IsConsortia", info.IsConsortia),
         new XAttribute("ConsortiaID", info.ConsortiaID),
         new XAttribute("Sex", info.Sex),
         new XAttribute("Win", info.Win),
         new XAttribute("Total", info.Total),
         new XAttribute("Escape", info.Escape),
         new XAttribute("GP", info.GP),
         new XAttribute("Honor", info.Honor),
         new XAttribute("Style", info.Style),
         new XAttribute("Colors", info.Colors),
         new XAttribute("Hide", info.Hide),
         new XAttribute("Grade", info.Grade),
         new XAttribute("State", info.State),
         new XAttribute("Repute", info.Repute),
         new XAttribute("Skin", info.Skin),
         new XAttribute("Offer", info.Offer),
         new XAttribute("IsMarried", info.IsMarried),
         new XAttribute("ConsortiaName", info.ConsortiaName),
         new XAttribute("DutyName", info.DutyName),
         new XAttribute("Nimbus", info.Nimbus),
         new XAttribute("FightPower", info.FightPower));
 }