public override void DoAction(IEventArgs args) { bool rw = FreeUtil.ReplaceBool(resetWeapon, args); bool rp = FreeUtil.ReplaceBool(resetPosition, args); PlayerEntity p = GetPlayerEntity(args); if (p != null) { CalculateDeadTime(p); p.gamePlay.LifeState = (int)EPlayerLifeState.Alive; p.gamePlay.CurHp = p.gamePlay.MaxHp; p.isFlagCompensation = true; p.gamePlay.CurArmor = p.gamePlay.MaxArmor; p.gamePlay.CurHelmet = p.gamePlay.MaxHelmet; //p.stateInterface.State.PlayerReborn(); p.position.InterpolateType = (int)PositionInterpolateMode.Discrete; p.position.ServerTime = args.GameContext.session.currentTimeObject.CurrentTime; p.gamePlay.InHurtedCount = 0; p.statisticsData.Statistics.EvenKillCount = 0; if (FreeUtil.ReplaceBool(resetWeapon, args)) { p.ModeController().RecoverPlayerWeapon(p); } PlayerAnimationAction.DoAnimation(args.GameContext, PlayerAnimationAction.PlayerReborn, p); } }
protected override void BuildMessage(IEventArgs args) { builder.Key = FreeMessageConstant.DuplicateUI; builder.Ss.Add(FreeUtil.ReplaceVar(key, args) + FreeMessageConstant.SpilterField + FreeUtil.ReplaceVar(type, args)); builder.Fs.Add(FreeUtil.ReplaceFloat(x, args)); builder.Fs.Add(FreeUtil.ReplaceFloat(y, args)); builder.Bs.Add(FreeUtil.ReplaceBool(show, args)); builder.Ks.Add(FreeUtil.ReplaceInt(relative, args)); if (values != null) { foreach (IFreeUIValue com in values) { builder.Ks.Add(com.GetSeq(args)); builder.Ins.Add(com.GetAutoStatus() * 100 + com.GetAutoIndex()); } foreach (IFreeUIValue com_1 in values) { object obj = com_1.GetValue(args); if (obj == null) { builder.Ss.Add("null"); } else { builder.Ss.Add(obj.ToString()); } } } }
public override void DoAction(IEventArgs args) { PlayerEntity player = GetPlayerEntity(args); if (player != null) { CalculateDeadTime(player, args); player.gamePlay.LifeState = (int)EPlayerLifeState.Alive; player.gamePlay.IsStandPosture = true; player.gamePlay.CurHp = player.gamePlay.MaxHp; player.isFlagCompensation = true; player.oxygenEnergyInterface.Oxygen.ResetOxygen(true); player.position.InterpolateType = (int)PositionInterpolateMode.Discrete; player.position.ServerTime = args.GameContext.session.currentTimeObject.CurrentTime; player.gamePlay.InHurtedCount = 0; player.statisticsData.Statistics.EvenKillCount = 0; player.WeaponController().RelatedThrowAction.ThrowingEntityKey = new EntityKey(0, (short)EEntityType.End); player.WeaponController().RelatedThrowAction.LastFireWeaponKey = -1; PlayerAnimationAction.DoAnimation(args.GameContext, PlayerAnimationAction.PlayerReborn, player); if (FreeUtil.ReplaceBool(resetWeapon, args)) { player.ModeController().RecoverPlayerWeapon(player, player.WeaponController().HeldBagPointer); } } }
public virtual bool GetBool(IEventArgs args) { if (!initialed || dynamic) { realValue = FreeUtil.ReplaceBool(para, args); initialed = true; } return((bool)realValue); }
protected override void BuildMessage(IEventArgs args) { this.scope = "4"; builder.Key = FreeMessageConstant.LockMouse; //True:Lock False:Unlock builder.Bs.Add(FreeUtil.ReplaceBool("{lock}", args)); }
public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; IGameUnit unit = GetPlayer(args); if (unit != null) { PlayerEntity p = ((FreeData)unit).Player; int itemId = FreeUtil.ReplaceInt(weaponId, args); int index = FreeUtil.ReplaceInt(weaponKey, args); EWeaponSlotType st = FreeWeaponUtil.GetSlotType(index); WeaponBaseAgent agent = null; if (index == 0) { agent = p.WeaponController().HeldWeaponAgent; } else { agent = p.WeaponController().GetWeaponAgent(st); } if (agent != null && agent.IsValid() && !FreeUtil.ReplaceBool(replace, args)) { return; } var scan = WeaponUtil.CreateScan(itemId); if (FreeUtil.ReplaceBool(fullAmmo, args)) { var weaponAllConfig = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(itemId); scan.Bullet = weaponAllConfig.PropertyCfg.Bullet; scan.ReservedBullet = weaponAllConfig.PropertyCfg.Bulletmax; } if (index == 0) { p.WeaponController().PickUpWeapon(scan); } else { p.WeaponController().ReplaceWeaponToSlot(st, scan); if (p.stateInterface.State.CanDraw() && p.WeaponController().HeldSlotType == EWeaponSlotType.None) { p.WeaponController().TryArmWeaponImmediately(st); } } SimpleProto message = new SimpleProto(); message.Key = FreeMessageConstant.PlaySound; message.Ks.Add(2); message.Ins.Add((int)EAudioUniqueId.PickupWeapon); message.Bs.Add(true); FreeMessageSender.SendMessage(p, message); } }
protected override void BuildMessage(IEventArgs args) { this.scope = "4"; builder.Key = FreeMessageConstant.ScoreInfo; //游戏是否开始 builder.Bs.Add(FreeUtil.ReplaceBool("{gameStart}", args)); //总玩家数 builder.Ins.Add(FreeUtil.ReplaceInt("{startPlayerCount}", args)); //存活者数 builder.Ins.Add(FreeUtil.ReplaceInt("{playerCount}", args)); //当前玩家击杀数(每个玩家不一样) if (args.GetUnit("current") != null) { builder.Ins.Add(FreeUtil.ReplaceInt("{current.killNum}", args)); } else { builder.Ins.Add(FreeUtil.ReplaceInt("{current.killNum}", args)); } //击杀者姓名 if (args.GetUnit("killer") == null) { builder.Ss.Add(FreeUtil.ReplaceVar("", args)); builder.Ds.Add(0); builder.Ins.Add(0); builder.Ins.Add(0); } else { //击杀者姓名 builder.Ss.Add(FreeUtil.ReplaceVar("{killer.name}", args)); //击杀者队伍ID builder.Ds.Add(FreeUtil.ReplaceDouble("{killer.id}", args)); //击杀者武器ID builder.Ins.Add(FreeUtil.ReplaceInt("{killer.currentWeaponId}", args)); //击杀方式 builder.Ins.Add(2); } //死者姓名 builder.Ss.Add(FreeUtil.ReplaceVar("{killed.name}", args)); //死者队伍ID builder.Ds.Add(FreeUtil.ReplaceDouble("{killed.id}", args)); //死亡方式 builder.Ins.Add(1); }
public override UnitPosition Select(IEventArgs args) { UnitPosition up = new UnitPosition(); up.SetX(FreeUtil.ReplaceFloat(x, args)); up.SetY(FreeUtil.ReplaceFloat(y, args)); up.SetZ(FreeUtil.ReplaceFloat(z, args)); up.SetYaw(FreeUtil.ReplaceFloat(yaw, args)); up.SetPitch(FreeUtil.ReplaceFloat(pitch, args)); up.SetInvalid(FreeUtil.ReplaceBool(invalid, args)); up.SetRandomindex(FreeUtil.ReplaceInt(randomindex, args)); return(up); }
public virtual IPara GetPara(IEventArgs args) { IPara para = ParaUtil.GetPara(type); if (para != null) { para = (IPara)para.Copy(); para.SetName(name); if (value == null) { value = string.Empty; } if (para is StringPara) { ((StringPara)para).SetValue(FreeUtil.ReplaceVar(value, args)); } else if (para is BoolPara) { ((BoolPara)para).SetValue(FreeUtil.ReplaceBool(value, args)); } else { double v = FreeUtil.ReplaceDouble(value, args); if (para is IntPara) { ((IntPara)para).SetValue((int)v); } else { if (para is FloatPara) { ((FloatPara)para).SetValue((float)v); } else { if (para is DoublePara) { ((DoublePara)para).SetValue(v); } } } } para.SetPublic(isPublic); para.SetName(FreeUtil.ReplaceVar(para.GetName(), args)); } return(para); }
public override void DoAction(IEventArgs args) { if (StringUtil.IsNullOrEmpty(key)) { key = BaseEventArgs.DEFAULT; } IParable unit = args.GetUnit(key); if (unit != null) { IPara sort = unit.GetParameters().Get(sorter); if (sort != null) { ParaListSet pls = (ParaListSet)sort; if (action != null) { Iterator <ParaList> it = pls.Iterator(); int i = 1; while (it.HasNext()) { ParaList pl = it.Next(); args.TempUse("element", new SimpleParable(pl)); args.GetDefault().GetParameters().TempUse(new IntPara("index", i++)); if (condition == null || condition.Meet(args)) { if (action != null) { action.Act(args); } if (FreeUtil.ReplaceBool(remove, args)) { it.Remove(); } } args.GetDefault().GetParameters().Resume("index"); args.Resume("element"); } if (i == 1) { if (noneAction != null) { noneAction.Act(args); } } } } } }
protected override void BuildMessage(IEventArgs args) { bool realShow = FreeUtil.ReplaceBool(show, args); int realUi = FreeUtil.ReplaceInt(ui, args); if (realUi == -1) { builder.Key = FreeMessageConstant.LockMouse; builder.Bs.Add(!realShow); } else { builder.Key = FreeMessageConstant.ShowCodeUI; builder.Ks.Add(realUi); builder.Bs.Add(realShow); } }
public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; PlayerEntity player = (PlayerEntity)fr.GetEntity(target); if (player != null) { if (player.gamePlay.IsDead()) { return; } PlayerEntity sourcePlayer = null; UnitPosition up = null; try { if (!string.IsNullOrEmpty(source)) { sourcePlayer = (PlayerEntity)fr.GetEntity(source); } if (string.IsNullOrEmpty(part)) { part = ((int)EBodyPart.Chest).ToString(); } if (pos != null) { up = pos.Select(args); } } catch (Exception e) { Logger.Error("PlayerHurtAction handle error" + e.Message); } PlayerDamageInfo damageInfo = new PlayerDamageInfo(FreeUtil.ReplaceFloat(damage, args), FreeUtil.ReplaceInt(type, args), FreeUtil.ReplaceInt(part, args), 0, false, false, FreeUtil.ReplaceBool(dead, args), up != null ? player.position.Value : Vector3.zero, up != null ? player.position.Value - up.Vector3 : Vector3.zero); BulletPlayerUtil.DoProcessPlayerHealthDamage(args.GameContext, (IGameRule)fr.Rule, sourcePlayer, player, damageInfo); } }
public override void DoAction(IEventArgs args) { IGameUnit unit = GetPlayer(args); if (unit != null) { PlayerEntity player = ((FreeData)unit).Player; if (FreeUtil.ReplaceBool(show, args)) { AppearanceUtils.EnableRender(player.thirdPersonModel.Value); player.gamePlay.GameState = GameState.Visible; } else { AppearanceUtils.DisableRender(player.thirdPersonModel.Value); player.gamePlay.GameState = GameState.Invisible; } } }
protected override void BuildMessage(IEventArgs args) { builder.Key = FreeMessageConstant.AddChild; builder.Bs.Add(FreeUtil.ReplaceBool(clear, args)); builder.Ss.Add(FreeUtil.ReplaceVar(key, args)); builder.Ss.Add(FreeUtil.ReplaceVar(parent, args)); builder.Ss.Add(ValueString(args)); builder.Ss.Add(EventString(args)); if (string.IsNullOrEmpty(eventKey)) { builder.Ss.Add(""); } else { builder.Ss.Add(eventKey); } }
protected override void BuildMessage(IEventArgs args) { builder.Key = FreeMessageConstant.PlaySound; builder.Bs.Add(FreeUtil.ReplaceBool(stop, args)); builder.Bs.Add(FreeUtil.ReplaceBool(loop, args)); builder.Bs.Add(pos != null); builder.Ins.Add(FreeUtil.ReplaceInt(id, args)); if (!string.IsNullOrEmpty(entity)) { foreach (FreeMoveEntity freeMoveEntity in args.GameContext.freeMove.GetEntities()) { if (freeMoveEntity.freeData.Key == entity) { builder.Ins.Add(freeMoveEntity.entityKey.Value.EntityId); } } } if (key != null) { builder.Ss.Add(FreeUtil.ReplaceVar(key, args)); } else { builder.Ss.Add(""); } if (pos != null) { UnitPosition up = pos.Select(args); builder.Fs.Add(up.GetX()); builder.Fs.Add(up.GetY()); builder.Fs.Add(up.GetZ()); } }
public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; PlayerEntity player = (PlayerEntity)fr.GetEntity(target); if (player != null) { if (player.gamePlay.IsDead()) { return; } PlayerEntity sourcePlayer = null; if (!string.IsNullOrEmpty(source)) { sourcePlayer = (PlayerEntity)fr.GetEntity(source); } if (string.IsNullOrEmpty(part)) { part = ((int)EBodyPart.Chest).ToString(); } PlayerDamageInfo damageInfo = new PlayerDamageInfo(FreeUtil.ReplaceFloat(damage, args), FreeUtil.ReplaceInt(type, args), FreeUtil.ReplaceInt(part, args), 0, false, false, FreeUtil.ReplaceBool(dead, args)); BulletPlayerUtility.DoProcessPlayerHealthDamage(args.GameContext, (IGameRule)fr.Rule, sourcePlayer, player, damageInfo, null); } }
public bool GetBool(string v) { return(FreeUtil.ReplaceBool(v, this)); }
private void SurvivalRank(List <IPlayerInfo> players, Dictionary <long, GameOverPlayer> goPlayerList, IEventArgs args, IPlayerInfo playerInfo) { if (players.Count < 1) { return; } long chickenTeamId = -1L; Dictionary <long, int> teamDeadDict = new Dictionary <long, int>(); Dictionary <long, int> teamRankDict = new Dictionary <long, int>(); foreach (IPlayerInfo ipi in players) { if (!ipi.StatisticsData.IsRunaway && ipi.StatisticsData.LastDeadTime <= 0L) { //和谐模式下,胜出5人不参与排序 if (!SharedConfig.IsHXMod && FreeUtil.ReplaceBool("{hasWin}", args)) { //没有逃跑且没有死亡->吃鸡 chickenTeamId = ipi.TeamId; } } if (teamDeadDict.ContainsKey(ipi.TeamId)) { if (ipi.StatisticsData.LastDeadTime > teamDeadDict[ipi.TeamId]) { teamDeadDict[ipi.TeamId] = (int)ipi.StatisticsData.LastDeadTime; } } else { teamDeadDict.Add(ipi.TeamId, (int)ipi.StatisticsData.LastDeadTime); } } //队伍总数 int teamCount = teamDeadDict.Count; teamRankDict.Add(chickenTeamId, 1); if (chickenTeamId != -1) { teamDeadDict.Remove(chickenTeamId);//去掉吃鸡队伍 } int rank = 1; //剩下队伍按最后死亡时间排序 teamDeadDict = teamDeadDict.OrderByDescending(o => o.Value).ToDictionary(p => p.Key, o => o.Value); foreach (var deadPair in teamDeadDict) { teamRankDict.Add(deadPair.Key, ++rank); } foreach (IPlayerInfo ipi in players) { if (ipi.StatisticsData.Rank != 1) { if (ipi.StatisticsData.IsRunaway) { ipi.StatisticsData.Rank = teamCount; } else { if (FreeUtil.ReplaceBool("{hasWin}", args)) { ipi.StatisticsData.Rank = teamRankDict[ipi.TeamId]; } else if (ipi.StatisticsData.LastDeadTime != 0L) { ipi.StatisticsData.Rank = teamRankDict[ipi.TeamId] - 1; } } } Logger.InfoFormat("player id {0} should be rank {1} in total team {2}, game has win ? {3}", ipi.PlayerId, ipi.StatisticsData.Rank, teamCount, FreeUtil.ReplaceBool("{hasWin}", args)); if (ipi.PlayerId == playerInfo.PlayerId) { playerInfo.StatisticsData.Rank = ipi.StatisticsData.Rank; } GameOverPlayer gop; goPlayerList.TryGetValue(ipi.PlayerId, out gop); if (gop != null) { gop.Statistics[(int)EStatisticsID.Rank] = ipi.StatisticsData.Rank; gop.Statistics[(int)EStatisticsID.RankAce] = ipi.StatisticsData.Rank == 1 ? 1 : 0; gop.Statistics[(int)EStatisticsID.RankTen] = ipi.StatisticsData.Rank <= 10 ? 1 : 0; } } }
protected override void BuildMessage(IEventArgs args) { builder.Key = 56; builder.Bs.Add(FreeUtil.ReplaceBool(recovery, args)); }