Beispiel #1
0
        public static void SetUnionPalaceCount(GameClient client, int count)
        {
            count = ((count < 0) ? 0 : count);
            UnionPalaceManager.ModifyUpCount(client, count);
            UnionPalaceData myUPData = client.ClientData.MyUnionPalaceData;

            myUPData.ZhanGongNeed = UnionPalaceManager.GetUnionPalaceZG(client, 0);
        }
Beispiel #2
0
        public static void ModifyUnionPalaceData(GameClient client, UnionPalaceData data)
        {
            List <int> dataList = new List <int>();

            dataList.AddRange(new int[] { data.StatueID, data.LifeAdd, data.AttackAdd, data.DefenseAdd, data.AttackInjureAdd });

            Global.SaveRoleParamsIntListToDB(client, dataList, RoleParamName.UnionPalace, true);
        }
Beispiel #3
0
        public static void SetUnionPalaceCount(GameClient client, int count)
        {
            count = count < 0 ? 0 : count;
            ModifyUpCount(client, count);

            UnionPalaceData myUPData = client.ClientData.MyUnionPalaceData;

            myUPData.ZhanGongNeed = GetUnionPalaceZG(client);
        }
Beispiel #4
0
 public static void initSetUnionPalaceProps(GameClient client, bool isUpdataProps = false)
 {
     lock (client.ClientData.LockUnionPalace)
     {
         client.ClientData.MyUnionPalaceData = null;
         UnionPalaceData UnionPalaceData = UnionPalaceManager.UnionPalaceGetData(client, isUpdataProps);
         GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
         GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
     }
 }
Beispiel #5
0
 private bool ProcessCmdUnionPalaceData(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     try
     {
         if (!CheckHelper.CheckCmdLengthAndRole(client, nID, cmdParams, 1))
         {
             return(false);
         }
         UnionPalaceData data = UnionPalaceManager.UnionPalaceGetData(client, false);
         client.sendCmd <UnionPalaceData>(1035, data, false);
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
     }
     return(false);
 }
Beispiel #6
0
        private bool ProcessCmdUnionPalaceUp(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            try
            {
                bool isCheck = CheckHelper.CheckCmdLength(client, nID, cmdParams, 1);
                if (!isCheck)
                {
                    return(false);
                }

                UnionPalaceData data = UnionPalaceUp(client);
                client.sendCmd((int)TCPGameServerCmds.CMD_SPR_UNION_PALACE_UP, data);

                return(true);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false);
            }

            return(false);
        }
Beispiel #7
0
 public static void SetUnionPalaceProps(GameClient client, UnionPalaceData myData)
 {
     lock (client.ClientData.LockUnionPalace)
     {
         int life    = 0;
         int attack  = 0;
         int defense = 0;
         int injure  = 0;
         UnionPalaceBasicInfo basicInfo = UnionPalaceManager.GetUPBasicInfoByID(myData.StatueID);
         int bangHuiLevel = Global.GetBangHuiLevel(client);
         if (basicInfo != null && basicInfo.UnionLevel <= bangHuiLevel && myData.StatueLevel <= bangHuiLevel)
         {
             life    = myData.LifeAdd;
             attack  = myData.AttackAdd;
             defense = myData.DefenseAdd;
             injure  = myData.AttackInjureAdd;
         }
         foreach (UnionPalaceBasicInfo d in UnionPalaceManager._unionPalaceBasicList.Values)
         {
             if (d.StatueID < myData.StatueID && d.UnionLevel <= bangHuiLevel && d.StatueLevel <= bangHuiLevel)
             {
                 life    += d.LifeMax;
                 attack  += d.AttackMax;
                 defense += d.DefenseMax;
                 injure  += d.AttackInjureMax;
             }
         }
         double lifePercent = 0.0;
         int    step        = (myData.StatueID - 1) / 8;
         if (step > 0)
         {
             if (myData.ResultType == 4 || myData.ResultType == -7)
             {
                 int maxID = 0;
                 IOrderedEnumerable <UnionPalaceBasicInfo> temp = from info in UnionPalaceManager._unionPalaceBasicList.Values
                                                                  where info.StatueID <= myData.StatueID && info.StatueLevel <= myData.StatueLevel && info.UnionLevel <= myData.UnionLevel && info.UnionLevel > 0
                                                                  orderby info.StatueID descending
                                                                  select info;
                 if (temp.Any <UnionPalaceBasicInfo>())
                 {
                     maxID = temp.First <UnionPalaceBasicInfo>().StatueID;
                 }
                 step = maxID / 8;
             }
             UnionPalaceSpecialInfo s = UnionPalaceManager.GetUPSpecialInfoByID(step);
             if (s != null && s.UnionLevel <= bangHuiLevel)
             {
                 lifePercent = s.MaxLifePercent;
             }
         }
         EquipPropItem propItem = new EquipPropItem();
         propItem.ExtProps[13] = (double)life;
         propItem.ExtProps[45] = (double)attack;
         propItem.ExtProps[46] = (double)defense;
         propItem.ExtProps[27] = (double)injure;
         propItem.ExtProps[14] = lifePercent;
         client.ClientData.PropsCacheManager.SetExtProps(new object[]
         {
             19,
             propItem.ExtProps
         });
     }
 }
Beispiel #8
0
        public static UnionPalaceData UnionPalaceUp(GameClient client)
        {
            UnionPalaceData result;

            lock (client.ClientData.LockUnionPalace)
            {
                UnionPalaceData myUPData = UnionPalaceManager.UnionPalaceGetData(client, false);
                if (myUPData.ResultType < 0)
                {
                    result = myUPData;
                }
                else if (myUPData.ResultType == 3 || myUPData.ResultType == -4)
                {
                    myUPData.ResultType = -4;
                    result = myUPData;
                }
                else if (!UnionPalaceManager.IsGongNengOpened(client))
                {
                    myUPData.ResultType = -1;
                    result = myUPData;
                }
                else
                {
                    UnionPalaceBasicInfo basicInfo = UnionPalaceManager.GetUPBasicInfoByID(myUPData.StatueID);
                    if (basicInfo.UnionLevel < 0)
                    {
                        myUPData.ResultType = -4;
                        result = myUPData;
                    }
                    else
                    {
                        int bhLevel = Global.GetBangHuiLevel(client);
                        if (basicInfo.UnionLevel > bhLevel)
                        {
                            myUPData.ResultType = -8;
                            result = myUPData;
                        }
                        else if (bhLevel < myUPData.StatueLevel)
                        {
                            myUPData.ResultType = -7;
                            result = myUPData;
                        }
                        else
                        {
                            int zhanGongNeed = UnionPalaceManager.GetUnionPalaceZG(client, 0);
                            if (!GameManager.ClientMgr.SubUserBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, zhanGongNeed))
                            {
                                myUPData.ResultType = -3;
                                result = myUPData;
                            }
                            else
                            {
                                UnionPalaceRateInfo rateInfo = UnionPalaceManager.GetUPRateInfoByID(basicInfo.StatueLevel);
                                int[] addNums = null;
                                int   rate    = 0;
                                int   r       = Global.GetRandomNumber(0, 100);
                                for (int i = 0; i < rateInfo.RateList.Count; i++)
                                {
                                    rate += rateInfo.RateList[i];
                                    if (r <= rate)
                                    {
                                        addNums            = rateInfo.AddNumList[rateInfo.RateList[i]].ToArray();
                                        myUPData.BurstType = i;
                                        break;
                                    }
                                }
                                List <int> logList = new List <int>();
                                logList.Add(myUPData.StatueID);
                                logList.Add(myUPData.LifeAdd);
                                logList.Add(myUPData.AttackAdd);
                                logList.Add(myUPData.DefenseAdd);
                                logList.Add(myUPData.AttackInjureAdd);
                                myUPData.LifeAdd         += addNums[0] * UnionPalaceManager._gmRate;
                                myUPData.LifeAdd          = ((myUPData.LifeAdd > basicInfo.LifeMax) ? basicInfo.LifeMax : myUPData.LifeAdd);
                                myUPData.AttackAdd       += addNums[1] * UnionPalaceManager._gmRate;
                                myUPData.AttackAdd        = ((myUPData.AttackAdd > basicInfo.AttackMax) ? basicInfo.AttackMax : myUPData.AttackAdd);
                                myUPData.DefenseAdd      += addNums[2] * UnionPalaceManager._gmRate;
                                myUPData.DefenseAdd       = ((myUPData.DefenseAdd > basicInfo.DefenseMax) ? basicInfo.DefenseMax : myUPData.DefenseAdd);
                                myUPData.AttackInjureAdd += addNums[3] * UnionPalaceManager._gmRate;
                                myUPData.AttackInjureAdd  = ((myUPData.AttackInjureAdd > basicInfo.AttackInjureMax) ? basicInfo.AttackInjureMax : myUPData.AttackInjureAdd);
                                if (myUPData.LifeAdd < basicInfo.LifeMax || myUPData.DefenseAdd < basicInfo.DefenseMax || myUPData.AttackAdd < basicInfo.AttackMax || myUPData.AttackInjureAdd < basicInfo.AttackInjureMax)
                                {
                                    myUPData.ResultType = 1;
                                }
                                else
                                {
                                    myUPData.StatueID++;
                                    basicInfo                = UnionPalaceManager.GetUPBasicInfoByID(myUPData.StatueID);
                                    myUPData.StatueType      = basicInfo.StatueType;
                                    myUPData.StatueLevel     = basicInfo.StatueLevel;
                                    myUPData.LifeAdd         = 0;
                                    myUPData.AttackAdd       = 0;
                                    myUPData.DefenseAdd      = 0;
                                    myUPData.AttackInjureAdd = 0;
                                    myUPData.ResultType      = 2;
                                    if (myUPData.StatueID > UnionPalaceManager._unionPalaceBasicList.Count || basicInfo.UnionLevel < 0)
                                    {
                                        myUPData.ResultType = 3;
                                    }
                                    else if (bhLevel < basicInfo.UnionLevel)
                                    {
                                        myUPData.ResultType = 5;
                                    }
                                    else if (bhLevel < myUPData.StatueLevel)
                                    {
                                        myUPData.ResultType = 4;
                                    }
                                }
                                int today   = Global.GetOffsetDayNow();
                                int upCount = UnionPalaceManager.GetUpCount(client, today);
                                myUPData.ZhanGongNeed = UnionPalaceManager.GetUnionPalaceZG(client, upCount + 1);
                                UnionPalaceManager.ModifyUpCount(client, upCount + 1);
                                UnionPalaceManager.ModifyUnionPalaceData(client, myUPData);
                                client.ClientData.MyUnionPalaceData = myUPData;
                                UnionPalaceManager.SetUnionPalaceProps(client, myUPData);
                                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                                GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
                                myUPData.ZhanGongLeft = client.ClientData.BangGong;
                                logList.Add(myUPData.StatueID);
                                logList.Add(myUPData.LifeAdd);
                                logList.Add(myUPData.AttackAdd);
                                logList.Add(myUPData.DefenseAdd);
                                logList.Add(myUPData.AttackInjureAdd);
                                logList.Add(upCount);
                                EventLogManager.AddUnionPalaceEvent(client, LogRecordType.UnionPalace, new object[]
                                {
                                    logList.ToArray()
                                });
                                result = myUPData;
                            }
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #9
0
        public static UnionPalaceData UnionPalaceGetData(GameClient client, bool isUpdataProps = false)
        {
            UnionPalaceData myUPData2;

            lock (client.ClientData.LockUnionPalace)
            {
                UnionPalaceData      myUPData  = client.ClientData.MyUnionPalaceData;
                UnionPalaceBasicInfo basicInfo = null;
                if (!UnionPalaceManager.IsGongNengOpened(client))
                {
                    myUPData            = new UnionPalaceData();
                    myUPData.ResultType = -1;
                    myUPData2           = myUPData;
                }
                else if (Global.GetBangHuiLevel(client) <= 0)
                {
                    if (myUPData == null)
                    {
                        myUPData = new UnionPalaceData();
                    }
                    myUPData.ResultType = -2;
                    if (isUpdataProps)
                    {
                        UnionPalaceManager.SetUnionPalaceProps(client, myUPData);
                    }
                    myUPData2 = myUPData;
                }
                else
                {
                    if (myUPData == null)
                    {
                        myUPData = new UnionPalaceData();
                        List <int> data = Global.GetRoleParamsIntListFromDB(client, "UnionPalace");
                        if (data == null || data.Count <= 0)
                        {
                            myUPData.RoleID   = client.ClientData.RoleID;
                            myUPData.StatueID = 1;
                            UnionPalaceManager.ModifyUnionPalaceData(client, myUPData);
                        }
                        else
                        {
                            myUPData.RoleID          = client.ClientData.RoleID;
                            myUPData.StatueID        = data[0];
                            myUPData.LifeAdd         = data[1];
                            myUPData.AttackAdd       = data[2];
                            myUPData.DefenseAdd      = data[3];
                            myUPData.AttackInjureAdd = data[4];
                        }
                        basicInfo            = UnionPalaceManager.GetUPBasicInfoByID(myUPData.StatueID);
                        myUPData.StatueType  = basicInfo.StatueType;
                        myUPData.StatueLevel = basicInfo.StatueLevel;
                        client.ClientData.MyUnionPalaceData = myUPData;
                        UnionPalaceManager.SetUnionPalaceProps(client, myUPData);
                    }
                    myUPData.ZhanGongNeed = UnionPalaceManager.GetUnionPalaceZG(client, 0);
                    myUPData.UnionLevel   = Global.GetBangHuiLevel(client);
                    myUPData.BurstType    = 0;
                    if (basicInfo == null)
                    {
                        basicInfo = UnionPalaceManager.GetUPBasicInfoByID(myUPData.StatueID);
                    }
                    if (basicInfo.UnionLevel < 0)
                    {
                        myUPData.ResultType = 3;
                        if (myUPData.UnionLevel < 9)
                        {
                            myUPData.ResultType = 4;
                        }
                    }
                    else
                    {
                        myUPData.ResultType = 0;
                        if (myUPData.UnionLevel < basicInfo.UnionLevel)
                        {
                            myUPData.ResultType = 5;
                            if (myUPData.LifeAdd != 0 || myUPData.AttackInjureAdd != 0 || myUPData.DefenseAdd != 0 || myUPData.AttackAdd != 0 || myUPData.StatueType > 1)
                            {
                                myUPData.ResultType = 4;
                            }
                            else
                            {
                                int maxLevel = 0;
                                IOrderedEnumerable <UnionPalaceBasicInfo> temp = from info in UnionPalaceManager._unionPalaceBasicList.Values
                                                                                 where info.StatueID <= myUPData.StatueID && info.StatueLevel <= myUPData.StatueLevel && info.UnionLevel <= myUPData.UnionLevel && info.UnionLevel > 0
                                                                                 orderby info.StatueID descending
                                                                                 select info;
                                if (temp.Any <UnionPalaceBasicInfo>())
                                {
                                    maxLevel = temp.First <UnionPalaceBasicInfo>().StatueLevel;
                                }
                                if (basicInfo.StatueLevel > maxLevel + 1)
                                {
                                    myUPData.ResultType = 4;
                                }
                            }
                        }
                    }
                    if (isUpdataProps)
                    {
                        UnionPalaceManager.SetUnionPalaceProps(client, myUPData);
                    }
                    myUPData.ZhanGongLeft = client.ClientData.BangGong;
                    myUPData2             = myUPData;
                }
            }
            return(myUPData2);
        }
Beispiel #10
0
        public static void SetUnionPalaceProps(GameClient client, UnionPalaceData myData)
        {
            lock (client.ClientData.LockUnionPalace)
            {
                //加成
                int life    = 0;
                int attack  = 0;
                int defense = 0;
                int injure  = 0;

                UnionPalaceBasicInfo basicInfo = GetUPBasicInfoByID(myData.StatueID);
                int bangHuiLevel = Global.GetBangHuiLevel(client);
                if (basicInfo != null && basicInfo.UnionLevel <= bangHuiLevel && myData.StatueLevel <= bangHuiLevel)
                {
                    life    = myData.LifeAdd;
                    attack  = myData.AttackAdd;
                    defense = myData.DefenseAdd;
                    injure  = myData.AttackInjureAdd;
                }

                foreach (UnionPalaceBasicInfo d in _unionPalaceBasicList.Values)
                {
                    if (d.StatueID < myData.StatueID && d.UnionLevel <= bangHuiLevel && d.StatueLevel <= bangHuiLevel)
                    {
                        life    += d.LifeMax;
                        attack  += d.AttackMax;
                        defense += d.DefenseMax;
                        injure  += d.AttackInjureMax;
                    }
                }

                //额外加成
                double lifePercent = 0;
                int    step        = (myData.StatueID - 1) / STATUE_COUNT;
                if (step > 0)
                {
                    if (myData.ResultType == (int)EUnionPalaceState.PalaceMore || myData.ResultType == (int)EUnionPalaceState.EPalaceMore)
                    {
                        int maxID = 0;
                        var temp  = from info in _unionPalaceBasicList.Values
                                    where info.StatueID <= myData.StatueID && info.StatueLevel <= myData.StatueLevel && info.UnionLevel <= myData.UnionLevel && info.UnionLevel > 0
                                    orderby info.StatueID descending
                                    select info;

                        if (temp.Any())
                        {
                            maxID = temp.First <UnionPalaceBasicInfo>().StatueID;
                        }
                        step = maxID / STATUE_COUNT;
                    }

                    UnionPalaceSpecialInfo s = GetUPSpecialInfoByID(step);
                    if (s != null && s.UnionLevel <= bangHuiLevel)
                    {
                        lifePercent = s.MaxLifePercent;
                    }
                }

                EquipPropItem propItem = new EquipPropItem();
                propItem.ExtProps[(int)ExtPropIndexes.MaxLifeV]        = life;
                propItem.ExtProps[(int)ExtPropIndexes.AddAttack]       = attack;
                propItem.ExtProps[(int)ExtPropIndexes.AddDefense]      = defense;
                propItem.ExtProps[(int)ExtPropIndexes.AddAttackInjure] = injure;
                propItem.ExtProps[(int)ExtPropIndexes.MaxLifePercent]  = lifePercent;
                client.ClientData.PropsCacheManager.SetExtProps((int)PropsSystemTypes.UnionPalace, propItem.ExtProps);
            }
        }
Beispiel #11
0
        public static UnionPalaceData UnionPalaceUp(GameClient client)
        {
            lock (client.ClientData.LockUnionPalace)
            {
                UnionPalaceData myUPData = UnionPalaceGetData(client);
                if (myUPData.ResultType < (int)EUnionPalaceState.Default)
                {
                    return(myUPData);
                }

                if (myUPData.ResultType == (int)EUnionPalaceState.End || myUPData.ResultType == (int)EUnionPalaceState.EOver)
                {
                    myUPData.ResultType = (int)EUnionPalaceState.EOver;
                    return(myUPData);
                }

                UnionPalaceBasicInfo basicInfo = GetUPBasicInfoByID(myUPData.StatueID);
                if (basicInfo.UnionLevel < 0)
                {
                    myUPData.ResultType = (int)EUnionPalaceState.EOver;
                    return(myUPData);
                }

                int bhLevel = Global.GetBangHuiLevel(client);
                if (basicInfo.UnionLevel > bhLevel)
                {
                    myUPData.ResultType = (int)EUnionPalaceState.EUnionNeedUp;
                    return(myUPData);
                }

                if (bhLevel < myUPData.StatueLevel)
                {
                    myUPData.ResultType = (int)EUnionPalaceState.EPalaceMore;
                    return(myUPData);
                }

                int zhanGongNeed = GetUnionPalaceZG(client);
                if (!GameManager.ClientMgr.SubUserBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, zhanGongNeed))
                {
                    myUPData.ResultType = (int)EUnionPalaceState.EnoZhanGong;
                    return(myUPData);
                }

                //几率
                UnionPalaceRateInfo rateInfo = GetUPRateInfoByID(basicInfo.StatueLevel);
                int[] addNums = null;
                int   rate    = 0;
                int   r       = Global.GetRandomNumber(0, 100);
                for (int i = 0; i < rateInfo.RateList.Count; i++)
                {
                    rate += rateInfo.RateList[i];
                    if (r <= rate)
                    {
                        addNums            = rateInfo.AddNumList[rateInfo.RateList[i]].ToArray();
                        myUPData.BurstType = i;//暴击
                        break;
                    }
                }

                List <int> logList = new List <int>();
                logList.Add(myUPData.StatueID);
                logList.Add(myUPData.LifeAdd);
                logList.Add(myUPData.AttackAdd);
                logList.Add(myUPData.DefenseAdd);
                logList.Add(myUPData.AttackInjureAdd);

                //加成
                myUPData.LifeAdd += addNums[0] * _gmRate;
                myUPData.LifeAdd  = myUPData.LifeAdd > basicInfo.LifeMax ? basicInfo.LifeMax : myUPData.LifeAdd;

                myUPData.AttackAdd += addNums[1] * _gmRate;
                myUPData.AttackAdd  = myUPData.AttackAdd > basicInfo.AttackMax ? basicInfo.AttackMax : myUPData.AttackAdd;

                myUPData.DefenseAdd += addNums[2] * _gmRate;
                myUPData.DefenseAdd  = myUPData.DefenseAdd > basicInfo.DefenseMax ? basicInfo.DefenseMax : myUPData.DefenseAdd;

                myUPData.AttackInjureAdd += addNums[3] * _gmRate;
                myUPData.AttackInjureAdd  = myUPData.AttackInjureAdd > basicInfo.AttackInjureMax ? basicInfo.AttackInjureMax : myUPData.AttackInjureAdd;

                if (myUPData.LifeAdd < basicInfo.LifeMax || myUPData.DefenseAdd < basicInfo.DefenseMax ||
                    myUPData.AttackAdd < basicInfo.AttackMax || myUPData.AttackInjureAdd < basicInfo.AttackInjureMax)
                {
                    myUPData.ResultType = (int)EUnionPalaceState.Success;
                }
                else
                {
                    myUPData.StatueID   += 1;
                    basicInfo            = GetUPBasicInfoByID(myUPData.StatueID);
                    myUPData.StatueType  = basicInfo.StatueType;
                    myUPData.StatueLevel = basicInfo.StatueLevel;

                    myUPData.LifeAdd         = 0;
                    myUPData.AttackAdd       = 0;
                    myUPData.DefenseAdd      = 0;
                    myUPData.AttackInjureAdd = 0;

                    myUPData.ResultType = (int)EUnionPalaceState.Next;
                    if (myUPData.StatueID > _unionPalaceBasicList.Count || basicInfo.UnionLevel < 0)
                    {
                        myUPData.ResultType = (int)EUnionPalaceState.End;
                    }
                    else if (bhLevel < basicInfo.UnionLevel)
                    {
                        myUPData.ResultType = (int)EUnionPalaceState.UnionNeedUp;
                    }
                    else if (bhLevel < myUPData.StatueLevel)
                    {
                        myUPData.ResultType = (int)EUnionPalaceState.PalaceMore;
                    }
                }

                int today   = Global.GetOffsetDayNow();
                int upCount = GetUpCount(client, today);
                myUPData.ZhanGongNeed = GetUnionPalaceZG(client, upCount + 1);

                ModifyUpCount(client, upCount + 1);
                ModifyUnionPalaceData(client, myUPData);

                client.ClientData.MyUnionPalaceData = myUPData;

                SetUnionPalaceProps(client, myUPData);

                //通知客户端属性变化
                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                // 总生命值和魔法值变化通知(同一个地图才需要通知)
                GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

                myUPData.ZhanGongLeft = client.ClientData.BangGong;

                logList.Add(myUPData.StatueID);
                logList.Add(myUPData.LifeAdd);
                logList.Add(myUPData.AttackAdd);
                logList.Add(myUPData.DefenseAdd);
                logList.Add(myUPData.AttackInjureAdd);
                logList.Add(upCount);

                EventLogManager.AddUnionPalaceEvent(client, LogRecordType.UnionPalace, logList.ToArray());

                //LogManager.WriteLog(LogTypes.Error, string.Format("-------------------------------------------union palace end {0}", myUPData.StatueID));
                return(myUPData);
            }
        }
Beispiel #12
0
        //BangHuiDetailData unionData = Global.GetBangHuiDetailData(client.ClientData.RoleID, Global.GetBangHuiLevel(client));
        public static UnionPalaceData UnionPalaceGetData(GameClient client, bool isUpdataProps = false)
        {
            lock (client.ClientData.LockUnionPalace)
            {
                UnionPalaceData      myUPData  = client.ClientData.MyUnionPalaceData;
                UnionPalaceBasicInfo basicInfo = null;

                if (!IsGongNengOpened())
                {
                    myUPData            = new UnionPalaceData();
                    myUPData.ResultType = (int)EUnionPalaceState.EnoOpen;
                    return(myUPData);
                }

                if (Global.GetBangHuiLevel(client) <= 0)
                {
                    if (myUPData == null)
                    {
                        myUPData = new UnionPalaceData();
                    }
                    myUPData.ResultType = (int)EUnionPalaceState.ENoHave;

                    if (isUpdataProps)
                    {
                        SetUnionPalaceProps(client, myUPData);
                    }

                    return(myUPData);
                }

                if (myUPData == null)
                {
                    myUPData = new UnionPalaceData();

                    List <int> data = Global.GetRoleParamsIntListFromDB(client, RoleParamName.UnionPalace);
                    if (data == null || data.Count <= 0)
                    {
                        myUPData.RoleID   = client.ClientData.RoleID;
                        myUPData.StatueID = DEFAULT_MIN_ID;

                        ModifyUnionPalaceData(client, myUPData);
                    }
                    else
                    {
                        myUPData.RoleID          = client.ClientData.RoleID;
                        myUPData.StatueID        = data[0];
                        myUPData.LifeAdd         = data[1];
                        myUPData.AttackAdd       = data[2];
                        myUPData.DefenseAdd      = data[3];
                        myUPData.AttackInjureAdd = data[4];
                    }

                    basicInfo            = GetUPBasicInfoByID(myUPData.StatueID);
                    myUPData.StatueType  = basicInfo.StatueType;
                    myUPData.StatueLevel = basicInfo.StatueLevel;

                    client.ClientData.MyUnionPalaceData = myUPData;
                    SetUnionPalaceProps(client, myUPData);
                }

                myUPData.ZhanGongNeed = GetUnionPalaceZG(client);
                myUPData.UnionLevel   = Global.GetBangHuiLevel(client);
                myUPData.BurstType    = 0;
                if (basicInfo == null)
                {
                    basicInfo = GetUPBasicInfoByID(myUPData.StatueID);
                }

                if (basicInfo.UnionLevel < 0)
                {
                    myUPData.ResultType = (int)EUnionPalaceState.End;
                    if (myUPData.UnionLevel < UNION_PALACE_MAX_LEVEL)
                    {
                        myUPData.ResultType = (int)EUnionPalaceState.PalaceMore;
                    }
                }
                else
                {
                    myUPData.ResultType = (int)EUnionPalaceState.Default;
                    if (myUPData.UnionLevel < basicInfo.UnionLevel)
                    {
                        myUPData.ResultType = (int)EUnionPalaceState.UnionNeedUp;
                        //
                        if (myUPData.LifeAdd != 0 || myUPData.AttackInjureAdd != 0 || myUPData.DefenseAdd != 0 || myUPData.AttackAdd != 0 || myUPData.StatueType > 1)
                        {
                            myUPData.ResultType = (int)EUnionPalaceState.PalaceMore;
                        }
                        else
                        {
                            int maxLevel = 0;
                            var temp     = from info in _unionPalaceBasicList.Values
                                           where info.StatueID <= myUPData.StatueID && info.StatueLevel <= myUPData.StatueLevel && info.UnionLevel <= myUPData.UnionLevel && info.UnionLevel > 0
                                           orderby info.StatueID descending
                                           select info;

                            if (temp.Any())
                            {
                                maxLevel = temp.First <UnionPalaceBasicInfo>().StatueLevel;
                            }

                            if (basicInfo.StatueLevel > maxLevel + 1)
                            {
                                myUPData.ResultType = (int)EUnionPalaceState.PalaceMore;
                            }
                        }
                    }
                }

                if (isUpdataProps)
                {
                    SetUnionPalaceProps(client, myUPData);
                }

                myUPData.ZhanGongLeft = client.ClientData.BangGong;
                // LogManager.WriteLog(LogTypes.Error, string.Format("-------------------------------------------union palace end {0}", myUPData.StatueID));

                return(myUPData);
            }
        }