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); }
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); }
public override void OnPlayerLeave(ObjPlayer player) { if (player == null) { return; } base.OnPlayerLeave(player); player.Proxy.NotifyStartMaYaFuBenGuide(1); // 给主角删除buff var buff1 = -1; var buff2 = -1; if (player.GetRole() == 0) //战士 { buff1 = 513; buff2 = 510; } else if (player.GetRole() == 1) //法师 { buff1 = 514; buff2 = 511; } else if (player.GetRole() == 2) // 弓手 { buff1 = 515; buff2 = 512; } if (buff1 == -1 || buff2 == -1) { return; } player.DeleteBuff(buff1, eCleanBuffType.EffectOver); player.DeleteBuff(buff2, eCleanBuffType.EffectOver); }
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); }