Example #1
0
        public override void OnPlayerRelive(ObjPlayer player, bool byItem)
        {
            base.OnPlayerRelive(player, byItem);
            foreach (var buffId in DieBuffId)
            {
                player.AddBuff(buffId, 1, player);
            }
            if (!byItem)
            {
                //player.SetPosition(RelivePos.Range());
                //player.SyncCharacterPostion();
                player.AddBuff(InvincibleBuffId, 1, player);
            }

            PushActionToAllPlayer(proxyPlayer =>
            {
                if (!proxyPlayer.Active)
                {
                    return;
                }

                // 向客户端刷新副本信息
                Msg.Int32OneList.Clear();
                Msg.Int32OneList.Add(GetAlivePlayerNum());
                Msg.Int32OneList.Add(PlayerCount);
                proxyPlayer.Proxy.NotifyRefreshDungeonInfo(Msg);
            });
        }
Example #2
0
 private void PlayerRelive(ObjPlayer player)
 {
     //随机位置重生
     player.SetPosition(RelivePos.Range());
     foreach (var buffId in DieBuffId)
     {
         player.AddBuff(buffId, 1, player);
     }
     player.Relive();
     player.AddBuff(InvincibleBuffId, 1, player);
 }
Example #3
0
        public override void AfterPlayerEnterOver(ObjPlayer player)
        {
            if (player.IsDead())
            {
                player.Relive();
            }
            else
            {
                player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
                player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
            }

            if (mPlayerInfo.ContainsKey(player.ObjId))
            {
                return;
            }

            mPlayerInfo.Add(player.ObjId, player.GetName());
            mPlayers.Add(player);

            // 限制buff
            player.AddBuff(3001, 1, player);
            // 同步位置
            player.SyncCharacterPostion();

            if (Trggers[(int)eDungeonTimerType.WaitStart] == null)
            {
                StartTimer(eDungeonTimerType.WaitStart, DateTime.Now.AddSeconds(5), TimeOverStart);
            }
            NotifyDungeonTime(player, eDungeonTimerType.WaitStart);

            OnTriggerStartWarn(player);
        }
Example #4
0
        public override void OnPlayerEnterOver(ObjPlayer player)
        {
            if (player == null)
            {
                return;
            }
            base.OnPlayerEnterOver(player);
            int idx = _playerList.FindIndex(r => r.objId == player.ObjId);

            if (idx >= 0)
            {
                _playerList.RemoveAt(idx);
            }

            JPlayer p = new JPlayer();

            p.objId = player.ObjId;
            p.name  = player.GetName();
            p.lv    = 1;
            _playerList.Add(p);
            var tb = Table.GetCheckenLv(p.lv);

            if (tb != null)
            {//buff
                player.AddBuff(tb.BaseBuff, 1, player);
            }
            SendRadius(player);
        }
Example #5
0
        public void CheckAvgLevelBuff(SceneManager _this, ObjPlayer objPlayer)
        {
            objPlayer.DeleteBuff(319, eCleanBuffType.TimeOver);
            var serverId = SceneExtension.GetServerLogicId(objPlayer.ServerId);
            var avgLevel = _this.GetAvgLevel(serverId);

            if (avgLevel <= 150)
            {
                return;
            }
            var playerLevel = objPlayer.GetLevel();

            if (playerLevel < _this.minLevel)
            {
                return;
            }
            if (playerLevel + _this.minDev > avgLevel)
            {
                return;
            }
            var a         = (_this.maxExpMul - 2.0f) / (_this.maxDev - _this.minDev);
            var b         = _this.maxExpMul - a * _this.maxDev;
            var buffLevel = ((avgLevel - playerLevel) * a + b);

            if (buffLevel > _this.maxExpMul)
            {
                buffLevel = _this.maxExpMul;
            }
            objPlayer.AddBuff(319, (int)buffLevel * 100, objPlayer);
        }
Example #6
0
        public void CheckAddLifeCardBuff(SceneManager _this, ObjPlayer objPlayer)
        {
            var tbRecharge = Table.GetRecharge(41);

            if (null == tbRecharge)
            {
                return;
            }
            var buffId = tbRecharge.Param[1];

            objPlayer.DeleteBuff(buffId, eCleanBuffType.TimeOver);
            objPlayer.AddBuff(buffId, 1, objPlayer);
        }
Example #7
0
        public override void AfterPlayerEnterOver(ObjPlayer player)
        {
            if (player.IsDead())
            {
                player.Relive();
            }
            else
            {
                player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
                player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
            }

            ChangeDifficulty(PlayerCount);

            mPlayer = player;
            pvpId   = player.mDbData.P1vP1CharacterId;
            if (mAutoPlayer == null)
            {
                if (mHasHold)
                {
                    if (Trggers[(int)eDungeonTimerType.WaitStart] == null)
                    {
                        StartTimer(eDungeonTimerType.WaitStart, DateTime.Now.AddSeconds(5), TimeOverStart);
                    }
                    NotifyDungeonTime(player, eDungeonTimerType.WaitStart);
                    Exdata = 1;
                }
                else
                {
                    StartDungeon();
                    Exdata = 0;
                }

                player.AddBuff(3001, 1, player);
                if (StaticData.IsRobot(pvpId))
                {
                    var tbScene = Table.GetScene(TypeId);
                    mAutoPlayer = CreateAutoPlayer((int)pvpId,
                                                   new Vector2((float)tbScene.PVPPosX, (float)tbScene.PVPPosZ), new Vector2(1, 0));
                    mAutoPlayer.AddBuff(3001, 1, mAutoPlayer);
                }
                else
                {
                    CoroutineFactory.NewCoroutine(GetAutoPlayerInScene, pvpId).MoveNext();
                }
            }
        }
Example #8
0
        private void OnPlayerGetExp(ObjPlayer player, JPlayer jp, int exp)
        {
            var tb = Table.GetCheckenLv(jp.lv);

            if (tb == null)
            {
                return;
            }
            jp.exp += exp;
            Dict_int_int_Data data = new Dict_int_int_Data();

            if (tb.NeedExp <= jp.exp)
            {
                var tbnew = Table.GetCheckenLv(jp.lv + 1);
                if (tbnew == null)//达到最大等级
                {
                    jp.exp = tb.NeedExp;
                }
                else
                {
                    //删除旧的buff
                    var tbold = Table.GetCheckenLv(jp.lv);
                    if (tbold != null)
                    {//buff
                        player.DeleteBuff(tbold.BaseBuff, eCleanBuffType.Clear);
                    }

                    jp.exp -= tb.NeedExp;
                    jp.lv++;

                    player.AddBuff(tbnew.BaseBuff, 1, player);

                    var ids = RandBuffList(tb.BuffGroup, 3);
                    foreach (var id in ids)
                    {
                        int lv = 0;
                        jp.buf.TryGetValue(id, out lv);
                        data.Data.Add(id, lv + 1);
                    }
                }
            }
            player.Proxy.CK_NotifyClientLevelup(player.mObjId, jp.lv, jp.exp, data);
        }
Example #9
0
        public override void OnPlayerEnterOver(ObjPlayer player)
        {
            base.OnPlayerEnterOver(player);

            if (player.GetCamp() == -1)
            {
                KickPlayer(player.ObjId);
                return;
            }

            //如果是守城方,加buff
            if (player.GetCamp() == DefenderCampId)
            {
                foreach (var buffId in DefenderBuffs)
                {
                    for (int i = 0, imax = buffId.Value; i < imax; i++)
                    {
                        player.AddBuff(buffId.Key, 1, player);
                    }
                }
            }

//             if (State == eDungeonState.WillStart)
//             {
//                 var t = GetTriggerTime(eDungeonTimerType.WaitStart);
//                 var param = (int) (t - DateTime.Now).TotalSeconds;
//                 param = param << 1;
//                 param += 1;
//                 player.Proxy.NotifyBattleReminder(19, Utils.WrapDictionaryId(41015), param);
//             }

            var delta = startTime - DateTime.Now;

            if (delta.TotalSeconds > 0)
            {
                player.Proxy.NotifyCommonCountdown((int)delta.TotalSeconds);
            }
        }
Example #10
0
 public override void AfterPlayerEnterOver(ObjPlayer player)
 {
     player.AddBuff(3010, 1, player);
 }
Example #11
0
        public override void OnPlayerPickItem(ObjPlayer player, ObjDropItem item)
        {
            if (player.mIsDead)
            {
                return;
            }
            if (item.TableDrop.Type != 300)
            {
                return;
            }
            var tbChecken = Table.GetChecken(item.TableDrop.Exdata[0]);

            if (tbChecken == null)
            {
                return;
            }
            var p = _playerList.Find(r => r.objId == player.ObjId);

            if (p == null)
            {
                return;
            }

            //播放特效
            player.Proxy.NotifyPlayEffect(700);

            //添加经验
            OnPlayerGetExp(player, p, tbChecken.ExData1);
            int idx = _playerList.FindIndex(r => r.objId == player.ObjId);

            //添加吃鸡的积分
            if (_playerList[idx] != null)
            {
                _playerList[idx].point += tbChecken.ExData2;
            }

            //添加Buff
            player.AddBuff(tbChecken.BuffId, 1, player);
            //添加道具
            Dict_int_int_Data data = new Dict_int_int_Data();

            for (int i = 0; i < tbChecken.ItemID.Length && i < tbChecken.Num.Length; i++)
            {
                if (tbChecken.ItemID[i] > 0 && tbChecken.Num[i] > 0)
                {
                    data.Data.Add(tbChecken.ItemID[i], tbChecken.Num[i]);
                }
            }
            for (int i = 0; i < dropBuffList.Count; i++)
            {
                if (item.ObjId == dropBuffList[i].ObjId)
                {
                    dropBuffList.RemoveAt(i);
                    break;
                }
            }
            for (int i = 0; i < dropChickenList.Count; i++)
            {
                if (item.ObjId == dropChickenList[i].ObjId)
                {
                    dropChickenList.RemoveAt(i);
                    break;
                }
            }

            CoroutineFactory.NewCoroutine(GiveItemList, player, data).MoveNext();
        }