Exemple #1
0
        public Player(IGamePlayer player, int id, BaseGame game, int team)
            : base(id, game, team, "", "", 1000, 0, 1)                   //TODO   lastPatemer    direction
        {
            m_rect   = new Rectangle(-15, -20, 30, 30);
            m_player = player;
            m_player.GamePlayerId = id;
            m_isActive            = true;
            m_canGetProp          = true;
            Grade = player.PlayerCharacter.Grade;

            TotalAllHurt           = 0;
            TotalAllHitTargetCount = 0;
            TotalAllShootCount     = 0;
            TotalAllKill           = 0;
            TotalAllExperience     = 0;
            TotalAllScore          = 0;
            TotalAllCure           = 0;
            m_weapon = m_player.MainWeapon;
            if (m_weapon != null)
            {
                var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID);
                m_mainBallId = ballConfig.Common;
                m_spBallId   = ballConfig.Special;
                //m_mainBallId = m_weapon.Property1;
                //m_spBallId = m_weapon.Property2;
            }
            m_loadingProcess = 0;

            InitBuffer(m_player.EquipEffect);
            m_energy   = (m_player.PlayerCharacter.Agility / 30 + 240);
            m_maxBlood = (int)((950 + m_player.PlayerCharacter.Grade * 50 + LevelPlusBlood + m_player.PlayerCharacter.Defence / 10) * m_player.GetBaseBlood());
        }
Exemple #2
0
        public void SetCurrentWeapon(ItemTemplateInfo item)
        {
            this.m_weapon = item;
            BallConfigInfo ballConfigInfo = BallConfigMgr.FindBall(this.m_weapon.TemplateID);

            this.m_mainBallId     = ballConfigInfo.Common;
            this.m_spBallId       = ballConfigInfo.Special;
            this.m_sp2BallId      = ballConfigInfo.SpecialII;
            this.m_AddWoundBallId = ballConfigInfo.CommonAddWound;
            this.m_MultiBallId    = ballConfigInfo.CommonMultiBall;
            this.SetBall(this.m_mainBallId);
        }
Exemple #3
0
        public void SetCurrentWeapon(ItemTemplateInfo item)
        {
            m_weapon = item;
            //m_mainBallId = m_weapon.Property1;
            //m_spBallId = m_weapon.Property2;
            var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID);

            m_mainBallId = ballConfig.Common;
            m_spBallId   = ballConfig.Special;

            SetBall(m_mainBallId);
        }
Exemple #4
0
        public void SetCurrentWeapon(ItemTemplateInfo item)
        {
            m_weapon = item;
            var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID);

            m_mainBallId     = ballConfig.Common;
            m_spBallId       = ballConfig.Special;
            m_sp2BallId      = ballConfig.SpecialII;
            m_AddWoundBallId = ballConfig.CommonAddWound;
            m_MultiBallId    = ballConfig.CommonMultiBall;
            SetBall(m_mainBallId);
        }
Exemple #5
0
        public override void Reset()
        {
            m_maxBlood = (int)((950 + m_player.PlayerCharacter.Grade * 50 + LevelPlusBlood + m_player.PlayerCharacter.Defence / 10) * m_player.GetBaseBlood());
            if (m_game.RoomType == eRoomType.Treasure || m_game.RoomType == eRoomType.Boss)
            {
                m_game.Cards = new int[21];
            }
            else
            {
                m_game.Cards = new int[8];
            }

            Dander         = 0;
            m_energy       = (m_player.PlayerCharacter.Agility / 30 + 240);
            IsLiving       = true;
            FinishTakeCard = false;
            m_weapon       = m_player.MainWeapon;
            //m_mainBallId = m_weapon.Property1;
            //m_spBallId = m_weapon.Property2;
            var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID);

            m_mainBallId = ballConfig.Common;
            m_spBallId   = ballConfig.Special;
            BaseDamage   = m_player.GetBaseAttack();
            BaseGuard    = m_player.GetBaseDefence();

            Attack  = m_player.PlayerCharacter.Attack;
            Defence = m_player.PlayerCharacter.Defence;
            Agility = m_player.PlayerCharacter.Agility;
            Lucky   = m_player.PlayerCharacter.Luck;

            m_currentBall = BallMgr.FindBall(m_mainBallId);
            m_shootCount  = 1;
            m_ballCount   = 1;

            CurrentIsHitTarget = false;

            TotalCure           = 0;
            TotalHitTargetCount = 0;
            TotalHurt           = 0;
            TotalKill           = 0;
            TotalShootCount     = 0;
            LockDirection       = false;
            GainGP    = 0;
            GainOffer = 0;
            Ready     = false;
            PlayerDetail.ClearTempBag();

            LoadingProcess = 0;

            base.Reset();
        }
Exemple #6
0
        public override void Reset()
        {
            this.m_maxBlood = this.m_player.PlayerCharacter.hp;
            if (this.m_game.RoomType == eRoomType.Dungeon)
            {
                this.m_game.Cards = new int[21];
            }
            else
            {
                this.m_game.Cards = new int[9];
            }
            base.Dander         = 0;
            base.PetMP          = 10;
            base.psychic        = 40;
            this.m_energy       = this.m_player.PlayerCharacter.Agility / 30 + 240;
            base.IsLiving       = true;
            this.FinishTakeCard = false;
            this.m_DeputyWeapon = this.m_player.SecondWeapon;
            this.m_weapon       = this.m_player.MainWeapon;
            BallConfigInfo ballConfigInfo = BallConfigMgr.FindBall(this.m_weapon.TemplateID);

            this.m_mainBallId        = ballConfigInfo.Common;
            this.m_spBallId          = ballConfigInfo.Special;
            this.m_sp2BallId         = ballConfigInfo.SpecialII;
            this.m_AddWoundBallId    = ballConfigInfo.CommonAddWound;
            this.m_MultiBallId       = ballConfigInfo.CommonMultiBall;
            this.BaseDamage          = this.m_player.GetBaseAttack();
            this.BaseGuard           = this.m_player.GetBaseDefence();
            this.Attack              = (double)this.m_player.PlayerCharacter.Attack;
            this.Defence             = (double)this.m_player.PlayerCharacter.Defence;
            this.Agility             = (double)this.m_player.PlayerCharacter.Agility;
            this.Lucky               = (double)this.m_player.PlayerCharacter.Luck;
            this.m_currentBall       = BallMgr.FindBall(this.m_mainBallId);
            this.m_shootCount        = 1;
            this.m_ballCount         = 1;
            this.m_prop              = 0;
            this.CurrentIsHitTarget  = false;
            this.TotalCure           = 0;
            this.TotalHitTargetCount = 0;
            this.TotalHurt           = 0;
            this.TotalKill           = 0;
            this.TotalShootCount     = 0;
            this.LockDirection       = false;
            this.GainGP              = 0;
            this.GainOffer           = 0;
            this.Ready               = false;
            this.PlayerDetail.ClearTempBag();
            this.LoadingProcess = 0;
            this.skillcu        = 0;
            base.Reset();
        }
Exemple #7
0
 public Player(IGamePlayer player, int id, BaseGame game, int team, int maxBlood) : base(id, game, team, "", "", maxBlood, 0, 1)
 {
     this.m_rect   = new Rectangle(-15, -20, 30, 30);
     this.m_player = player;
     this.m_player.GamePlayerId = id;
     this.m_isActive            = true;
     this.m_canGetProp          = true;
     this.Grade    = player.PlayerCharacter.Grade;
     base.vaneOpen = player.PlayerCharacter.IsWeakGuildFinish(9);
     this.m_pet    = player.Pet;
     if (this.m_pet != null)
     {
         base.isPet      = true;
         base.PetBaseAtt = this.GetPetBaseAtt();
     }
     this.TotalAllHurt           = 0;
     this.TotalAllHitTargetCount = 0;
     this.TotalAllShootCount     = 0;
     this.TotalAllKill           = 0;
     this.TotalAllExperience     = 0;
     this.TotalAllScore          = 0;
     this.TotalAllCure           = 0;
     this.m_DeputyWeapon         = this.m_player.SecondWeapon;
     if (this.m_DeputyWeapon != null)
     {
         this.deputyWeaponResCount = this.m_DeputyWeapon.StrengthenLevel + 1;
     }
     else
     {
         this.deputyWeaponResCount = 1;
     }
     this.m_weapon = this.m_player.MainWeapon;
     if (this.m_weapon != null)
     {
         BallConfigInfo ballConfigInfo = BallConfigMgr.FindBall(this.m_weapon.TemplateID);
         this.m_mainBallId     = ballConfigInfo.Common;
         this.m_spBallId       = ballConfigInfo.Special;
         this.m_sp2BallId      = ballConfigInfo.SpecialII;
         this.m_AddWoundBallId = ballConfigInfo.CommonAddWound;
         this.m_MultiBallId    = ballConfigInfo.CommonMultiBall;
     }
     this.m_loadingProcess = 0;
     this.m_prop           = 0;
     this.InitBuffer(this.m_player.EquipEffect);
     this.m_energy   = this.m_player.PlayerCharacter.Agility / 30 + 240;
     this.m_maxBlood = this.m_player.PlayerCharacter.hp;
     this.skillcu    = 0;
 }
Exemple #8
0
        public override bool Start()
        {
            if (m_isRunning)
            {
                return(false);
            }
            try
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                Thread.CurrentThread.Priority = ThreadPriority.Normal;

                GameProperties.Refresh();


                if (!InitComponent(RecompileScripts(), "Recompile Scripts"))
                {
                    return(false);
                }

                if (!InitComponent(StartScriptComponents(), "Script components"))
                {
                    return(false);
                }

                if (!InitComponent((GameProperties.EDITION == Edition), "Edition:" + Edition))
                {
                    return(false);
                }

                if (!InitComponent(InitSocket(IPAddress.Parse(Configuration.Ip), Configuration.Port), "InitSocket Port:" + Configuration.Port))
                {
                    return(false);
                }

                if (!InitComponent(AllocatePacketBuffers(), "AllocatePacketBuffers()"))
                {
                    return(false);
                }

                if (!InitComponent(LogMgr.Setup(Configuration.GAME_TYPE, Configuration.ServerID, Configuration.AreaID), "LogMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(WorldMgr.Init(), "WorldMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(MapMgr.Init(), "MapMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ItemMgr.Init(), "ItemMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ItemBoxMgr.Init(), "ItemBox Init"))
                {
                    return(false);
                }

                if (!InitComponent(BallMgr.Init(), "BallMgr Init"))
                {
                    return(false);
                }
                if (!InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(FusionMgr.Init(), "FusionMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(AwardMgr.Init(), "AwardMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(MissionInfoMgr.Init(), "MissionInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(PveInfoMgr.Init(), "PveInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(DropMgr.Init(), "Drop Init"))
                {
                    return(false);
                }

                if (!InitComponent(FightRateMgr.Init(), "FightRateMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ConsortiaLevelMgr.Init(), "ConsortiaLevelMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(RefineryMgr.Init(), "RefineryMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(StrengthenMgr.Init(), "StrengthenMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(PropItemMgr.Init(), "PropItemMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ShopMgr.Init(), "ShopMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(QuestMgr.Init(), "QuestMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(RoomMgr.Setup(Configuration.MaxRoomCount), "RoomMgr.Setup"))
                {
                    return(false);
                }

                if (!InitComponent(GameMgr.Setup(Configuration.ServerID, GameProperties.BOX_APPEAR_CONDITION), "GameMgr.Start()"))
                {
                    return(false);
                }

                if (!InitComponent(ConsortiaMgr.Init(), "ConsortiaMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(RateMgr.Init(Configuration), "ExperienceRateMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(MacroDropMgr.Init(), "MacroDropMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(BattleMgr.Setup(), "BattleMgr Setup"))
                {
                    return(false);
                }

                if (!InitComponent(InitGlobalTimer(), "Init Global Timers"))
                {
                    return(false);
                }

                if (!InitComponent(MarryRoomMgr.Init(), "MarryRoomMgr Init"))
                {
                    return(false);
                }
                if (!InitComponent(LogMgr.Setup(1, 4, 4), "LogMgr Setup"))
                {
                    return(false);
                }
                GameEventMgr.Notify(ScriptEvent.Loaded);

                if (!InitComponent(InitLoginServer(), "Login To CenterServer"))
                {
                    return(false);
                }

                RoomMgr.Start();
                GameMgr.Start();
                BattleMgr.Start();
                MacroDropMgr.Start();

                if (!InitComponent(base.Start(), "base.Start()"))
                {
                    return(false);
                }



                GameEventMgr.Notify(GameServerEvent.Started, this);

                GC.Collect(GC.MaxGeneration);

                if (log.IsInfoEnabled)
                {
                    log.Info("GameServer is now open for connections!");
                }

                m_isRunning = true;
                return(true);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Failed to start the server", e);
                }

                return(false);
            }
        }
Exemple #9
0
        public override bool Start()
        {
            if (m_running)
            {
                return(false);
            }
            try
            {
                m_running = true;

                Thread.CurrentThread.Priority = ThreadPriority.Normal;

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                //初始化监听端口
                if (!InitComponent(InitSocket(m_config.Ip, m_config.Port), "InitSocket Port:" + m_config.Port))
                {
                    return(false);
                }

                //初始化脚本
                if (!InitComponent(StartScriptComponents(), "Script components"))
                {
                    return(false);
                }

                if (!InitComponent(ProxyRoomMgr.Setup(), "RoomMgr.Setup"))
                {
                    return(false);
                }

                if (!InitComponent(GameMgr.Setup(0, 4), "GameMgr.Setup"))
                {
                    return(false);
                }

                if (!InitComponent(MapMgr.Init(), "MapMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ItemMgr.Init(), "ItemMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(PropItemMgr.Init(), "ItemMgr Init"))
                {
                    return(false);
                }

                //if (!InitComponent(VaneMgr.ByteAray(), "VaneMgr ByteAray"))
                //   return false;

                if (!InitComponent(BallMgr.Init(), "BallMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init"))
                {
                    return(false);
                }
                if (!InitComponent(DropMgr.Init(), "DropMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init"))
                {
                    return(false);
                }

                //发布脚本已加载事件
                GameEventMgr.Notify(ScriptEvent.Loaded);

                if (!InitComponent(base.Start(), "base.Start()"))
                {
                    return(false);
                }

                ProxyRoomMgr.Start();
                GameMgr.Start();

                //发布服务器开始事件
                GameEventMgr.Notify(GameServerEvent.Started, this);

                GC.Collect(GC.MaxGeneration);

                log.Info("GameServer is now open for connections!");

                return(true);
            }
            catch (Exception e)
            {
                log.Error("Failed to start the server", e);
                return(false);
            }
        }
        public override bool Start()
        {
            if (this.m_running)
            {
                return(false);
            }
            bool result;

            try
            {
                this.m_running = true;
                Thread.CurrentThread.Priority = ThreadPriority.Normal;
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException);
                if (!this.InitComponent(this.InitSocket(this.m_config.Ip, this.m_config.Port), "InitSocket Port:" + this.m_config.Port))
                {
                    result = false;
                }
                else
                {
                    if (!this.InitComponent(this.StartScriptComponents(), "Script components"))
                    {
                        result = false;
                    }
                    else
                    {
                        if (!this.InitComponent(ProxyRoomMgr.Setup(), "RoomMgr.Setup"))
                        {
                            result = false;
                        }
                        else
                        {
                            if (!this.InitComponent(GameMgr.Setup(0, 4), "GameMgr.Setup"))
                            {
                                result = false;
                            }
                            else
                            {
                                if (!this.InitComponent(MapMgr.Init(), "MapMgr Init"))
                                {
                                    result = false;
                                }
                                else
                                {
                                    if (!this.InitComponent(ItemMgr.Init(), "ItemMgr Init"))
                                    {
                                        result = false;
                                    }
                                    else
                                    {
                                        if (!this.InitComponent(PropItemMgr.Init(), "PropItemMgr Init"))
                                        {
                                            result = false;
                                        }
                                        else
                                        {
                                            if (!this.InitComponent(BallMgr.Init(), "BallMgr Init"))
                                            {
                                                result = false;
                                            }
                                            else
                                            {
                                                if (!this.InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init"))
                                                {
                                                    result = false;
                                                }
                                                else
                                                {
                                                    if (!this.InitComponent(DropMgr.Init(), "DropMgr Init"))
                                                    {
                                                        result = false;
                                                    }
                                                    else
                                                    {
                                                        if (!this.InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init"))
                                                        {
                                                            result = false;
                                                        }
                                                        else
                                                        {
                                                            if (!this.InitComponent(WindMgr.Init(), "WindMgr Init"))
                                                            {
                                                                result = false;
                                                            }
                                                            else
                                                            {
                                                                if (!this.InitComponent(GoldEquipMgr.Init(), "GoldEquipMgr Init"))
                                                                {
                                                                    result = false;
                                                                }
                                                                else
                                                                {
                                                                    if (!this.InitComponent(LanguageMgr.Setup(""), "LanguageMgr Init"))
                                                                    {
                                                                        result = false;
                                                                    }
                                                                    else
                                                                    {
                                                                        GameEventMgr.Notify(ScriptEvent.Loaded);
                                                                        if (!this.InitComponent(base.Start(), "base.Start()"))
                                                                        {
                                                                            result = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            ProxyRoomMgr.Start();
                                                                            GameMgr.Start();
                                                                            GameEventMgr.Notify(GameServerEvent.Started, this);
                                                                            GC.Collect(GC.MaxGeneration);
                                                                            FightServer.log.Info("GameServer is now open for connections!");
                                                                            result = true;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                FightServer.log.Error("Failed to start the server", exception);
                result = false;
            }
            return(result);
        }