Пример #1
0
 public override void Release()
 {
     i_biAccID  = 0;
     i_lordInfo = null;
     i_maps     = null;
     i_stat     = null;
 }
Пример #2
0
 public override void Release()
 {
     i_biAccID  = 0;
     i_lordInfo = null;
     i_items    = null;
     i_stat     = null;
     i_induns   = null;
 }
Пример #3
0
        public override eErrorCode Execute()
        {
            if (i_biAccID == 0 || true == string.IsNullOrEmpty(i_strName))
            {
                return(eErrorCode.Query_Params);
            }

            if (true == IsExistsName(i_strName))
            {
                return(eErrorCode.Lord_AlreadyExistName);
            }

            var db = GetDatabase();

            if (null == db)
            {
                return(eErrorCode.Server_Error);
            }

            var trans = GetDatabase().CreateTransaction();

            fmLordBase       lordInfo    = null;
            rdStat           lordStat    = null;
            List <rdItem>    items       = null;
            List <rdMission> missions    = null;
            List <rdMap>     maps        = null;
            fmMissionBase    missionBase = null;
            List <rdInDun>   inDuns      = null;

            if (false == theLordCreater.TryCreate(i_biAccID, i_strName, out o_lord))
            {
                return(eErrorCode.Server_TableError);
            }

            o_lord.TryGetItems(out items);
            o_lord.TryGetLordBase(out lordInfo);
            o_lord.TryGetStat(out lordStat);

            trans.InsertName(i_strName, i_biAccID);
            trans.SetLordBase(i_biAccID, lordInfo);
            trans.SetLordStat(i_biAccID, lordStat);
            trans.SetLordItems(i_biAccID, items);
            trans.SetMissions(i_biAccID, missions);
            trans.SetMaps(i_biAccID, maps);
            trans.SetMissionBase(i_biAccID, missionBase);
            trans.SetLordInDuns(i_biAccID, inDuns);

            if (false == trans.Execute())
            {
                return(eErrorCode.Query_Fail);
            }

            return(eErrorCode.Success);
        }
Пример #4
0
        // Stat
        public static bool GetLordStat(this IDatabase db, long accid, out rdStat obj)
        {
            obj = null;
            string strValue = db.StringGet(GetKeyLordStat(accid));

            if (true == string.IsNullOrEmpty(strValue))
            {
                return(false);
            }
            obj = new JavaScriptSerializer().Deserialize <rdStat>(strValue);
            return(true);
        }
Пример #5
0
        public override eErrorCode Execute()
        {
            var db = GetDatabase();

            if (false == db.IsExistsLord(i_biAccID))
            {
                return(eErrorCode.Lord_NoneExist);
            }

            o_lord         = new fmLord();
            o_lord.ActTime = fmServerTime.Now;
            o_lord.State   = eLordState.Login;

            try
            {
                o_lord.AccId = i_biAccID;

                fmLordBase lordInfo = null;

                rdStat           lordStat    = null;
                List <rdItem>    items       = null;
                List <rdMission> missions    = null;
                List <rdMap>     maps        = null;
                fmMissionBase    missionBase = null;
                List <rdInDun>   inDuns      = null;

                db.GetLordBase(i_biAccID, out lordInfo);
                db.GetLordStat(i_biAccID, out lordStat);
                db.GetLordItems(i_biAccID, out items);
                db.GetMissions(i_biAccID, out missions);
                db.GetMaps(i_biAccID, out maps);
                db.GetMissionBase(i_biAccID, out missionBase);
                db.GetLordInDuns(i_biAccID, out inDuns);

                o_lord.InitLordBase(lordInfo);
                o_lord.InitStat(lordStat);
                o_lord.InitItems(items);
            }
            catch (Exception ex)
            {
                Logger.Error("accid:{0}, ex:{1}", i_biAccID, ex.ToString());
                return(eErrorCode.Query_Fail);
            }

            if (true == o_lord.Block)
            {
                return(eErrorCode.Server_Block);
            }

            return(eErrorCode.Success);
        }
Пример #6
0
 protected virtual void Dispose(bool disposing)
 {
     if (m_disposed)
     {
         return;
     }
     if (disposing)
     {
         if (null != m_stat)
         {
             m_stat.Dispose();
             m_stat = null;
         }
     }
     m_disposed = true;
 }
Пример #7
0
        public static bool TryCreate(long accid, string name, out fmLord o_lord)
        {
            o_lord         = new fmLord();
            o_lord.ActTime = fmServerTime.Now;
            o_lord.State   = eLordState.Create;
            o_lord.AccId   = accid;

            fmLordBase lordInfo = new fmLordBase
            {
                Name     = name,
                Lv       = 1,
                Exp      = 0,
                Gold     = 4000,
                GameRuby = 20,
                AccRuby  = 0,
                Stone    = 20,
                //Ticket = 10,
                PvpPoint = 5,
                Floor    = 2,
                DTombCnt = 9,
                //DTombTime = fmServerTime.Epoch,
                //MissionTime = fmServerTime.Epoch
                //DHeartCnt = 5,
                //DHeartFnc = 0,
                Payment = false,
                SCKey   = 3,
                //Seal = 10,
            };

            rdStat lordStat = new rdStat
            {
                //TotalPoint = 3,
                Point = 0,
                Atk   = 1,
                Def   = 1,
                Hp    = 1
            };

            fmMissionBase missionBase = new fmMissionBase
            {
                RefreshCnt  = theGameConst.MaxMissionRefreshCnt,
                MissionTime = fmServerTime.Epoch,
            };


            List <rdMap> maps = new List <rdMap>();

            foreach (var node in m_maps)
            {
                maps.Add(new rdMap {
                    Code = node.Code, Open = node.Open
                });
            }
            List <rdInDun> inDuns = new List <rdInDun>();

            foreach (var node in m_inDuns)
            {
                inDuns.Add(new rdInDun {
                    Code = node.Code, Shortcut = 0, CurPlace = 0, Forge = 0
                });
            }

            List <rdItem> items = new List <rdItem>();

            {
                // 무기
                rdItem item = new rdItem {
                    Slot = 1, Lv = 1, Grade = eGrade.Normal, Parts = eParts.Weapon, Code = 1, Equip = true, BaseOpt = new List <rdOption>(), AddOpts = new List <rdOption>()
                };
                item.BaseOpt.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.BWDMin, Value = 87
                });
                item.BaseOpt.Add(new rdOption {
                    Index = 2, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.BWDMax, Value = 97
                });
                item.BaseOpt.Add(new rdOption {
                    Index = 3, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.AS, Value = 1.02f
                });
                item.BaseOpt.Add(new rdOption {
                    Index = 4, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.Element, Value = 0
                });

                item.AddOpts.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.HP, Value = 15
                });
                items.Add(item);
            }
            {
                // 가슴
                rdItem item = new rdItem {
                    Slot = 2, Lv = 1, Grade = eGrade.Normal, Parts = eParts.Armor, Code = 20, Equip = true, BaseOpt = new List <rdOption>(), AddOpts = new List <rdOption>()
                };
                item.BaseOpt.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.DEF, Value = 6
                });
                item.AddOpts.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.ResistAll, Value = 11
                });
                items.Add(item);
            }
            {
                // 반지
                rdItem item = new rdItem {
                    Slot = 3, Lv = 1, Grade = eGrade.Normal, Parts = eParts.Ring, Code = 9, Equip = true, BaseOpt = new List <rdOption>(), AddOpts = new List <rdOption>()
                };
                item.BaseOpt.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.ResistNone, Value = 9
                });
                item.AddOpts.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.BWDMin, Value = 1
                });
                items.Add(item);
            }
            {
                // 바지
                rdItem item = new rdItem {
                    Slot = 4, Lv = 1, Grade = eGrade.Normal, Parts = eParts.Pants, Code = 16, Equip = true, BaseOpt = new List <rdOption>(), AddOpts = new List <rdOption>()
                };
                item.BaseOpt.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.HP, Value = 16
                });
                item.AddOpts.Add(new rdOption {
                    Index = 1, Grade = eOptGrade.Normal, Remelt = false, Kind = eOption.BWDMax, Value = 2
                });
                items.Add(item);
            }

            o_lord.State = eLordState.Create;
            o_lord.InitLordBase(lordInfo);
            o_lord.InitStat(lordStat);
            o_lord.InitItems(items);

            return(true);
        }
Пример #8
0
        public static void SetLordStat(this ITransaction trans, long accid, rdStat dataObj)
        {
            string strValue = new JavaScriptSerializer().Serialize(dataObj);

            trans.StringSetAsync(GetKeyLordStat(accid), strValue);
        }
Пример #9
0
        public static bool SetLordStat(this IDatabase db, long accid, rdStat dataObj)
        {
            string strValue = new JavaScriptSerializer().Serialize(dataObj);

            return(db.StringSet(GetKeyLordStat(accid), strValue));
        }
Пример #10
0
 public override void Release()
 {
     i_biAccID = 0;
     i_rdStat  = null;
 }
Пример #11
0
 public bool TryGetStat(out rdStat stat)
 {
     stat = m_stat;
     return(true);
 }
Пример #12
0
 public bool InitStat(rdStat stat)
 {
     m_stat = stat;
     return(true);
 }
Пример #13
0
 public bool TryGetStat(out rdStat stat)
 {
     return(m_stat.TryGetStat(out stat));
 }
Пример #14
0
 public bool InitStat(rdStat stat)
 {
     return(m_stat.InitStat(stat));
 }