public static int AASStateGet(GamePlayer player)
        {
            int userID = player.PlayerCharacter.ID;
            bool result = true;
            player.IsAASInfo = false;
            player.IsMinor = true;

            using (ProduceBussiness db = new ProduceBussiness())
            {
                String ID = db.GetASSInfoSingle(userID);
                if (ID != "")
                {
                    player.IsAASInfo = true;
                    result = false;
                    int Age = Convert.ToInt32(ID.Substring(6, 4));
                    int month = Convert.ToInt32(ID.Substring(10, 2));

                    if (DateTime.Now.Year.CompareTo(Age + 18) > 0 || (DateTime.Now.Year.CompareTo(Age + 18) == 0 && DateTime.Now.Month.CompareTo(month) >= 0))
                        player.IsMinor = false;
                }
            }
            //int now=  DateTime.Now.Month;

            if (result && player.PlayerCharacter.IsFirst != 0 && player.PlayerCharacter.DayLoginCount < 1 && ISASSon)
            {
                player.Out.SendAASState(result);
            }

            //if (player.IsMinor || !player.IsAASInfo && ISASSon)
            //{
                player.Out.SendAASControl(AntiAddictionMgr.ISASSon, player.IsAASInfo, player.IsMinor);
            //}
            return 0;
        }
Example #2
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //if (player.CurrentGame.Data.CurrentSpell != this)
            if (player.CurrentGame.Data.CurrentFire == null)
            {
                player.CurrentGame.Data.CurrentSpell = this;
                player.CurrentGame.Data.CurrentPorp = item;
                //player.CurrentGame.Data.CurrentBall = Bussiness.Managers.BallMgr.FindBall(1);
                player.CurrentGame.Data.SetCurrentBall(BallMgr.FindBall(1), false);

                player.CurrentGame.Data.AddAttack = -1;
                player.CurrentGame.Data.AddBall = 1;
            }
            else
            {
                if (player.CurrentGame.Data.Players[player].IsFrost == 0)
                {
                    IceFronzeEffect ice = new IceFronzeEffect(item.Template.Property2);
                    ice.Start(player);
                }
                else
                {
                    player.CurrentGame.Data.Players[player].SetFrost(item.Template.Property2);
                }

            }
        }
 public override bool IsCompleted(GamePlayer player)
 {
     bool result=false;
     int tempComp=0;
     using (ConsortiaBussiness db = new ConsortiaBussiness())
     {
         ConsortiaInfo info = db.GetConsortiaSingle(player.PlayerCharacter.ConsortiaID);
         switch (m_info.Para1)
         {
             case 0:  //公会人数
                 tempComp=info.Count;
                 break;
             case 1:  //公会贡献度
                 tempComp=player.PlayerCharacter.RichesOffer+player.PlayerCharacter.RichesRob;
                 break;
             case 2:  //公会铁匠铺等级
                 tempComp=info.SmithLevel;
                 break;
             case 3:  //公会商城等级
                 tempComp=info.ShopLevel;
                 break;
             case 4:  //公会保管箱等级
                 tempComp = info.StoreLevel;
                 break;
             default:
                 break;
         }
         if (tempComp >= m_info.Para2)
         {
             Value = 0;
             result=true;
         }
         return result;
     }
 }
Example #4
0
        /// <summary>
        /// Removes a player from the scene.
        /// </summary>
        /// <param name="player"></param>
        public void RemovePlayer(GamePlayer player)
        {
            _locker.AcquireWriterLock(Timeout.Infinite);
            try
            {
                if (_players.ContainsKey(player.PlayerCharacter.ID))
                    _players.Remove(player.PlayerCharacter.ID);
            }
            finally
            {
                _locker.ReleaseWriterLock();
            }

            //通知客户端、场景用有人离开
            GamePlayer[] list = GetAllPlayer();
            GSPacketIn pkg = null;
            foreach (GamePlayer p in list)
            {
                if (pkg == null)
                {
                    pkg = p.Out.SendSceneRemovePlayer(player);
                }
                else
                {
                    p.Out.SendTCP(pkg);
                }
            }
        }
Example #5
0
 public CommonBag(GamePlayer player,int bagType)
     : base(49, bagType)
 {
     _player = player;
     _bagType = bagType;
     _removedList = new List<ItemInfo>();
 }
Example #6
0
        public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            //if (player.CurrentGame.Data.CurrentFire == player && player.CurrentGame.Data.ReduceFireBombs)
            //{
            //    player.CurrentGame.ReturnPacket(player, packet);

            //    int id = packet.ReadInt();

            //    player.CurrentGame.Data.BlastID = id;
            //    player.CurrentGame.Data.BlastX = packet.ReadInt();
            //    player.CurrentGame.Data.BlastY = packet.ReadInt();
            //    FireBallInfo ballInfo = player.CurrentGame.Data.FireBall[id];
            //    ballInfo.EndTime = packet.ReadInt();

            //    if (player.CurrentGame.Data.BlastX > 0)
            //    {
            //        int space = ballInfo.GetSpace(player.CurrentGame.Data.BlastX, player.CurrentGame.Data.BlastY, ballInfo.EndTime);
            //        if (space > 20)
            //        {
            //            GameServer.log.Error("子弹爆炸错误,距离为:" + space.ToString());
            //            player.Client.Disconnect();
            //            return false;
            //        }

            //    }

            //    process.TankFire(player.CurrentGame, player, player.CurrentGame.Data.BlastX, player.CurrentGame.Data.BlastY, ballInfo);
            //}
            return true;
        }
Example #7
0
 public virtual void Start(GamePlayer player)
 {
     m_info.UserID = player.PlayerId;
     m_info.IsExist = true;
     m_player = player;
     m_player.BufferList.AddBuffer(this);
 }
Example #8
0
        public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            //if (player.CurrentGame.Data.CurrentIndex == player || player.CurrentGame.Data.Players[player].State == TankGameState.FRIST || player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
            if (player.CurrentGame.Data.CurrentIndex == player || player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
            {
                player.CurrentGame.ReturnPacket(player, packet);
                player.CurrentGame.Data.Players[player].SetXY(packet.ReadInt(), packet.ReadInt());
                //player.CurrentGame.Data.Players[player].StartMoving();

                //GameServer.log.Error(string.Format("StopMoving {0} {1}",player.CurrentGame.Data.Players[player].X,player.CurrentGame.Data.Players[player].Y));
                
                //由于同步问题,暂时去掉
                //if (player.CurrentGame != null)
                //    player.CurrentGame.Data.Players[player].StartMoving();
               
                // GameServer.log.Error(string.Format("StopMoving {0} {1}", player.CurrentGame.Data.Players[player].X, player.CurrentGame.Data.Players[player].Y));
                return true;
            }
            else
            {
                //if (player.CurrentGame.Data.CurrentFire != null)
                //{
                    //int x = packet.ReadInt();
                    //player.CurrentGame.Data.Players[player].PosY = packet.ReadInt();
                //}
                //return true;
            }
            return false;
        }
 public bool GetAnnex(string value, GamePlayer player, ref string msg, ref bool result, ref eMessageType eMsg)
 {
     int gid = int.Parse(value);
     using (PlayerBussiness db = new PlayerBussiness())
     {
         ItemInfo goods = db.GetUserItemSingle(gid);
         if (goods != null)
         {
             if (goods.TemplateID == 11408)
             {
                 player.AddMedal(goods.Count);
                 return true;
             }
             else
             {
                 if (player.AddItem(goods))
                 {
                     eMsg = eMessageType.Normal;
                     return true;
                 }
                 else
                 {
                     eMsg = eMessageType.ERROR;
                     result = false;
                     msg = LanguageMgr.GetTranslation(goods.GetBagName()) + LanguageMgr.GetTranslation("MailGetAttachHandler.NoPlace");
                 }
             }
         }
     }
     return false;
 }
Example #10
0
 public PlayerInventory(GamePlayer player)
     : base(60,0)
 {
     _player = player;
     _removedList = new List<ItemInfo>();
     //LoadFromDatabase(player.PlayerCharacter.ID);
 }
Example #11
0
 public BufferList(GamePlayer player)
 {
     m_player = player;
     m_lock = new object();
     m_buffers = new List<AbstractBuffer>();
     m_clearList = new ArrayList();
 }
Example #12
0
 public CommonBag(GamePlayer player,int bagType,int count)
     : base(count, bagType, true)
 {
     _player = player;
     _bagType = bagType;
     _removedList = new List<ItemInfo>();
 }
        public override void OnPlayerStateChanged(BaseSceneGame game, GamePlayer player)
        {
            base.OnPlayerStateChanged(game, player);

            if (player.CurrentGameState == ePlayerGameState.FINISH && game.GameState == eGameState.LOAD)
                CanStartGame(game);
        }
Example #14
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            TankData data = player.CurrentGame.Data;
            data.AddWound = (data.AddWound + (double)item.Template.Property2 / 100);

            GSPacketIn pkg = player.Out.SendAddWound(player);
            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
        }
Example #15
0
        public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentHotSpringRoom != null)
            {

            }
            return false;
        }
        public void Execute(GamePlayer player, ItemInfo item)
        {
            TankData data = player.CurrentGame.Data;
            data.AddMultiple = (1- (double)item.Template.Property2 / 100);

            GSPacketIn pkg = player.Out.SendShootStraight(player);
            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
        }
Example #17
0
 /// <summary>
 /// 添加监听
 /// </summary>
 /// <param name="player"></param>
 public void AddToPlayer(GamePlayer player)
 {
     m_player = player;
     if (m_data.IsComplete == false)
     {
         AddTrigger(player);
     }
 }
Example #18
0
 /// <summary>
 /// 构造任务管理
 /// </summary>
 /// <param name="player"></param>
 public QuestInventory(GamePlayer player)
 {
     m_converter = new System.Text.UnicodeEncoding();
     m_player = player;
     m_lock = new object();
     m_list = new List<BaseQuest>();
     m_clearList = new ArrayList();
 }
Example #19
0
 public CreateRoomAction(GamePlayer player, String name, String password, eRoomType roomType, byte timeType)
 {
     m_player = player;
     m_name = name;
     m_password = password;
     m_roomType = roomType;
     m_timeType = timeType;
 }
Example #20
0
        public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            //if (player.CurrentGame.Data.CurrentFire != null && player.CurrentGame.Data.CurrentIndex != player && !(player.CurrentGame.Data.Players[player].State == TankGameState.DEAD 
            //    && player.CurrentTeamIndex == player.CurrentGame.Data.CurrentIndex.CurrentTeamIndex) && player.CanFly == false)
            //    return false;

            if (player.CurrentGame.Data.CurrentFire != null )
                return false;
            if (player.CurrentGame.Data.CurrentIndex != player|| !player.CanFly)
                return false;

            player.CanFly = false;
            GSPacketIn pkg = player.Out.SendPropUseRespone(player, -2, -2, CARRY_TEMPLATE_ID);
            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);

            //构造一个CARRY Item
            //ItemInfo CarryItem;
            //using (ProduceBussiness db = new ProduceBussiness())
            //{
            //    ItemTemplateInfo[] CarryTemplate = db.GetSingleCategory(10);

            //    foreach (ItemTemplateInfo tmp in CarryTemplate)
            //    {
            //        if (tmp.TemplateID == CARRY_TEMPLATE_ID)
            //        {
            //            CarryItem = ItemInfo.CreateFromTemplate(tmp, 1);

            //            if (CarryItem == null)
            //            {
            //                return false;
            //            }

            //            //if (player.CurrentGame.Data.CurrentIndex == player)
            //            //    player.CurrentGame.Data.TotalDelay += CarryItem.Template.Property5;

            //            ISpellHandler spellHandler = SpellMgr.LoadSpellHandler(CarryItem.Template.Property1);
            //            spellHandler.Execute(player.CurrentGame.Data.CurrentIndex, CarryItem);



            //            return true;
            //        }
            //    }
            //}

            ItemTemplateInfo templateInfo = Managers.PropItemMgr.FindAllProp(CARRY_TEMPLATE_ID);

            if (templateInfo != null)
            {
                ItemInfo CarryItem = ItemInfo.CreateFromTemplate(templateInfo, 1, (int)ItemAddType.TempProp);
                ISpellHandler spellHandler = SpellMgr.LoadSpellHandler(CarryItem.Template.Property1);
                spellHandler.Execute(player.CurrentGame.Data.CurrentIndex, CarryItem);
                return true;
            }

            return false;

        }
        public void Execute(GamePlayer player, ItemInfo item)
        {
            if (player.CurrentGame.Data.CurrentSpell != null)
                return;

            TankData data = player.CurrentGame.Data;
            data.BreachDefence = true;

        }
Example #22
0
 public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if (player.CurrentHotSpringRoom != null)
     {
         int num = packet.ReadInt();
         if (num <= 0)
         {
             return false;
         }
         if (player.PlayerCharacter.Money >= num)
         {
             player.RemoveMoney(num);
             LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Gift, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0, "", "", "");
             using (PlayerBussiness bussiness = new PlayerBussiness())
             {
                 string translation = LanguageMgr.GetTranslation("LargessCommand.Content", new object[] { player.PlayerCharacter.NickName, num / 2 });
                 string str2 = LanguageMgr.GetTranslation("LargessCommand.Title", new object[] { player.PlayerCharacter.NickName });
                 MailInfo mail = new MailInfo {
                     Annex1 = "",
                     Content = translation,
                     Gold = 0,
                     IsExist = true,
                     Money = num / 2,
                     Receiver = player.CurrentHotSpringRoom.Info.playerName,
                     ReceiverID = player.CurrentHotSpringRoom.Info.playerID,
                     Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]),
                     SenderID = 0,
                     Title = str2,
                     Type = 14
                 };
                 bussiness.SendMail(mail);
                 player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
                 MailInfo info2 = new MailInfo {
                     Annex1 = "",
                     Content = translation,
                     Gold = 0,
                     IsExist = true,
                     Money = num / 2,
                     Receiver = player.CurrentHotSpringRoom.Info.GroomName,
                     ReceiverID = player.CurrentHotSpringRoom.Info.GroomID,
                     Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]),
                     SenderID = 0,
                     Title = str2,
                     Type = 14
                 };
                 bussiness.SendMail(info2);
                 player.Out.SendMailResponse(info2.ReceiverID, eMailRespose.Receiver);
             }
             player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("LargessCommand.Succeed", new object[0]));
             GSPacketIn @in = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("LargessCommand.Notice", new object[] { player.PlayerCharacter.NickName, num }));
             player.CurrentHotSpringRoom.SendToPlayerExceptSelf(@in, player);
             return true;
         }
         player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0]));
     }
     return false;
 }
Example #23
0
 public override bool IsCompleted(GamePlayer player)
 {
     if (player.PlayerCharacter.IsMarried == true)
     {
         Value = 0;
         return true;
     }
     return false;
 }
Example #24
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //TankData data = player.CurrentGame.Data;
            //data.AttackUp *= item.Property1;
            player.CurrentGame.Data.Players[player].SetDander( item.Template.Property2);

            GSPacketIn pkg = player.Out.SendAttackUp(player);
            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
        }
 public override bool IsCompleted(GamePlayer player)
 {            
     if (player.GetItemCount(m_info.Para1) >= m_info.Para2)
     {
         Value = 0;
         return true;
     }
     return false;
 }
Example #26
0
        public EnterGameAction(GamePlayer player, int roomId, string pwd, int type)
        {
            m_player = player;

            m_roomId = roomId;

            m_pwd = pwd;

            m_type = type;
        }
Example #27
0
        public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentGame.Data.Players[player].State == TankGameState.DEAD || player.CurrentGame.GameState != eGameState.PLAY)
                return false;

            player.CurrentGame.ReturnPacket(player, packet);
            player.CurrentGame.Data.Players[player].Dead();

            return true;
        }
Example #28
0
 public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     //if (player.CurrentGame.Data.Players[player].State == TankGameState.FRIST)
     if (player.CurrentGame.GameState == eGameState.LOAD)
     {
         player.CurrentGame.ReturnPacket(player, packet);
         return true;
     }
     return false;
 }
 public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if (player.CurrentHotSpringRoom != null)
     {
         int num = packet.ReadInt();
         if (ItemMgr.FindItemTemplate(packet.ReadInt()) != null)
         {
         }
     }
     return false;
 }
Example #30
0
 public GameClient(GameServer svr,byte[] read,byte[] send)
     : base(read,send)
 {
     Lottery = -1;
     tempData = string.Empty;
     m_pingTime = DateTime.Now.Ticks;
     _srvr = svr;
     m_player = null;
     Encryted = true;
     AsyncPostSend = true;
 }