Beispiel #1
0
        public static float GetRate(eRateType eType)
        {
            float rate = 1f;

            RateMgr.m_lock.AcquireReaderLock(-1);
            float result;

            try
            {
                RateInfo _RateInfo = RateMgr.GetRateInfoWithType((int)eType);
                if (_RateInfo == null)
                {
                    result = rate;
                    return(result);
                }
                if (_RateInfo.Rate == 0f)
                {
                    result = 1f;
                    return(result);
                }
                if (RateMgr.IsValid(_RateInfo))
                {
                    rate = _RateInfo.Rate;
                }
            }
            catch
            {
            }
            finally
            {
                RateMgr.m_lock.ReleaseReaderLock();
            }
            result = rate;
            return(result);
        }
Beispiel #2
0
        public static float GetRate(eRateType eType)
        {
            float num = 1f;

            RateMgr.m_lock.AcquireReaderLock(15000);
            try
            {
                RateInfo rateInfoWithType = RateMgr.GetRateInfoWithType((int)eType);
                if (rateInfoWithType == null)
                {
                    float result = num;
                    return(result);
                }
                if (rateInfoWithType.Rate == 0f)
                {
                    float result = 1f;
                    return(result);
                }
                if (RateMgr.IsValid(rateInfoWithType))
                {
                    num = rateInfoWithType.Rate;
                }
            }
            catch
            {
            }
            finally
            {
                RateMgr.m_lock.ReleaseReaderLock();
            }
            return(num);
        }
Beispiel #3
0
 public static string GetAllRate()
 {
     return(string.Format("经验倍率:{0} \n财富倍率:{1} \n功勋倍率:{2} \n登陆器登陆经验倍率:{3} \n登陆器登陆财富倍率:{4} \n登陆器登陆功勋倍率:{5}", new object[]
     {
         RateMgr.GetRate(eRateType.Experience_Rate),
         RateMgr.GetRate(eRateType.Riches_Rate),
         RateMgr.GetRate(eRateType.Offer_Rate),
         RateMgr.GetRate(eRateType.Auncher_Experience_Rate),
         RateMgr.GetRate(eRateType.Auncher_Riches_Rate),
         RateMgr.GetRate(eRateType.Auncher_Offer_Rate)
     }));
 }
Beispiel #4
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);
        }
Beispiel #5
0
        public static float GetRate(GamePlayer player, eRateType eType)
        {
            float result;

            if (eType == eRateType.Auncher_Experience_Rate || eType == eRateType.Auncher_Offer_Rate || eType == eRateType.Auncher_Riches_Rate)
            {
                if (player.ClientType != eClientType.Auncher)
                {
                    result = 1f;
                    return(result);
                }
            }
            result = RateMgr.GetRate(eType);
            return(result);
        }
Beispiel #6
0
 public static bool ReLoad()
 {
     return(RateMgr.Init(GameServer.Instance.Configuration));
 }
Beispiel #7
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 playerCount = playercount / 2;



            int riches = 0;
            int state  = 2;
            int rate   = 1;
            int value  = 3;

            if (gameClass == eGameType.Guild)
            {
                value = 10;
                rate  = (int)RateMgr.GetRate(eRateType.Offer_Rate);
            }

            float richesRate = RateMgr.GetRate(eRateType.Riches_Rate);

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (gameClass == eGameType.Free)
                {
                    playerCount = 0;
                }
                else
                {
                    db.ConsortiaFight(consortiaWin, consortiaLose, playerCount, out riches, state, totalKillHealth, richesRate);
                }
                //(对方公会等级-3)*50*对方玩家人数(对方玩家人数是指进入战斗时的人数,中途退出或者掉线的玩家不改变这个数值)
                //玩家增加掠夺财富
                foreach (KeyValuePair <int, Player> p in players)
                {
                    //if (p.Value.State == TankGameState.LOSE)
                    //    continue;
                    if (p.Value == null)
                    {
                        continue;
                    }

                    if (p.Value.PlayerDetail.PlayerCharacter.ConsortiaID == consortiaWin)
                    {
                        p.Value.PlayerDetail.AddOffer((playerCount + value) * rate);

                        p.Value.PlayerDetail.PlayerCharacter.RichesRob += riches;
                    }
                    else if (p.Value.PlayerDetail.PlayerCharacter.ConsortiaID == consortiaLose)
                    {
                        p.Value.PlayerDetail.AddOffer((int)Math.Round(playerCount * 0.5) * rate);
                        p.Value.PlayerDetail.RemoveOffer(value);
                    }
                }
            }

            return(riches);
        }