//class PromoteObj : interfaceOfHM.ContactInterface //{ // public delegate void SetPromoteArrivalThreadM(int startT, Car car, SetPromote sp, int goMile, Node goPath, commandWithTime.ReturningOjb ro); // private SetPromote _sp; // SetPromoteArrivalThreadM _setPromoteArrivalThread; // public PromoteObj(SetPromote sp, SetPromoteArrivalThreadM spthread) // { // this._sp = sp; // this._setPromoteArrivalThread = spthread; // } // public string targetOwner // { // get { return ""; } // // get { return this._sp.ta} // } // public int target => throw new NotImplementedException(); // public bool carLeftConditions(Car car) // { // throw new NotImplementedException(); // } // public void SetArrivalThread(int startT, Car car, int goMile, Node goPath, commandWithTime.ReturningOjb returningOjb) // { // throw new NotImplementedException(); // } //} private commandWithTime.ReturningOjb promote(RoleInGame player, Car car, SetPromote sp, ref List <string> notifyMsg, out MileResultReason mrr) { RoleInGame boss; if (player.HasTheBoss(roomMain._Players, out boss)) { return(promotePassBossAddress(player, boss, car, sp, ref notifyMsg, out mrr)); //return promotePassBossAddress(player, boss, car, sp, ref notifyMsg, out reason); } else { //if(sp.pType=="mi") switch (sp.pType) { case "mile": case "business": case "volume": case "speed": { switch (car.state) { case CarState.waitAtBaseStation: { // if(player.Money<) OssModel.FastonPosition fpResult; var distanceIsEnoughToStart = that.theNearestToDiamondIsCarNotMoney(player, car, sp.pType, out fpResult); if (distanceIsEnoughToStart) { var from = this.getFromWhenAction(player, car); var to = that.GetPromotePositionTo(sp.pType); // this.promoteMilePosition; var fp1 = Program.dt.GetFpByIndex(from); var fp2 = Program.dt.GetFpByIndex(to); var baseFp = Program.dt.GetFpByIndex(player.StartFPIndex); var goPath = that.GetAFromB_v2(from, to, player, ref notifyMsg); // var returnPath = Program.dt.GetAFromB(to, player.StartFPIndex); var returnPath = that.GetAFromB_v2(to, player.StartFPIndex, player, ref notifyMsg); var goMile = that.GetMile(goPath); var returnMile = that.GetMile(returnPath); //第一步,计算去程和回程。 if (car.ability.leftMile >= goMile + returnMile) { int startT; this.EditCarStateWhenActionStartOK(player, ref car, to, fp1, goPath, ref notifyMsg, out startT); RoomMainF.RoomMain.commandWithTime.ReturningOjb ro = commandWithTime.ReturningOjb.ojbWithoutBoss(returnPath); that.diamondOwnerE.StartDiamondOwnerThread(startT, 0, player, car, sp, ro, goMile, goPath); // getAllCarInfomations(sp.Key, ref notifyMsg); mrr = MileResultReason.Abundant; return(ro); } else if (car.ability.leftMile >= goMile) { WebNotify(player, $"去程{goMile}km,回程{returnMile}km,去了回不来"); mrr = MileResultReason.CanNotReturn; return(player.returningOjb); } else { WebNotify(player, $"去程{goMile}km,回程{returnMile}km,去不了"); // printState(player, car, $"去程{goMile},回程{returnMile},去不了"); mrr = MileResultReason.CanNotReach; return(player.returningOjb); } } else { mrr = MileResultReason.NearestIsMoneyWhenPromote; this.WebNotify(player, $"离宝石最近的是[{fpResult.FastenPositionName}]处的钱,不是你的车。请离宝石再近点儿!"); return(player.returningOjb); } }; case CarState.waitOnRoad: { OssModel.FastonPosition fpResult; var distanceIsEnoughToStart = that.theNearestToDiamondIsCarNotMoney(player, car, sp.pType, out fpResult); if (distanceIsEnoughToStart) { var from = this.getFromWhenAction(player, car); var to = that.GetPromotePositionTo(sp.pType); // this.promoteMilePosition; var fp1 = Program.dt.GetFpByIndex(from); var fp2 = Program.dt.GetFpByIndex(to); var baseFp = Program.dt.GetFpByIndex(player.StartFPIndex); var goPath = that.GetAFromB_v2(from, to, player, ref notifyMsg); var returnPath = that.GetAFromB_v2(to, player.StartFPIndex, player, ref notifyMsg); var goMile = that.GetMile(goPath); var returnMile = that.GetMile(returnPath); //第一步,计算去程和回程。 if (car.ability.leftMile >= goMile + returnMile) { int startT; this.EditCarStateWhenActionStartOK(player, ref car, to, fp1, goPath, ref notifyMsg, out startT); RoomMainF.RoomMain.commandWithTime.ReturningOjb ro = commandWithTime.ReturningOjb.ojbWithoutBoss(returnPath); that.diamondOwnerE.StartDiamondOwnerThread(startT, 0, player, car, sp, ro, goMile, goPath); mrr = MileResultReason.Abundant; return(ro); } else if (car.ability.leftMile >= goMile) { WebNotify(player, $"去程{goMile}km,回程{returnMile}km,去了回不来"); mrr = MileResultReason.CanNotReturn; return(player.returningOjb); } else { WebNotify(player, $"去程{goMile}km,回程{returnMile}km,去不了"); mrr = MileResultReason.CanNotReach; return(player.returningOjb); } } else { mrr = MileResultReason.NearestIsMoneyWhenPromote; this.WebNotify(player, $"离宝石最近的是[{fpResult.FastenPositionName}]处的钱,不是你的车。请离宝石再近点儿!"); return(player.returningOjb); } }; default: { throw new Exception($"{Enum.GetName(typeof(CarState), car.state)}不是注册的类型!"); } } }; default: { throw new Exception($"{sp.pType}-不是规定的输入!"); }; } } }
public RoomMainF.RoomMain.commandWithTime.ReturningOjb contact(RoleInGame player, Car car, interfaceOfHM.ContactInterface ci, ref List <string> notifyMsg, out MileResultReason Mrr) { //sa = attackTargetChange(player, sa); RoleInGame boss; if (player.HasTheBoss(roomMain._Players, out boss)) { if (player.confuseRecord.IsBeingControlled()) { if (player.confuseRecord.getControlType() == Manager_Driver.ConfuseManger.ControlAttackType.Confuse) { return(randomWhenConfused(player, boss, car, ci, ref notifyMsg, out Mrr)); } else { return(contactPassBossAddress(player, boss, car, ci, ref notifyMsg, out Mrr)); } } else { return(contactPassBossAddress(player, boss, car, ci, ref notifyMsg, out Mrr)); } //return promotePassBossAddress(player, boss, car, sp, ref notifyMsg, out reason); } else { if (that._Players.ContainsKey(ci.targetOwner)) { //beneficiary var victimOrBeneficiary = that._Players[ci.targetOwner]; OssModel.FastonPosition fpResult; var distanceIsEnoughToStart = that.theNearestToPlayerIsCarNotMoney(player, car, victimOrBeneficiary, out fpResult); if (distanceIsEnoughToStart) { if (ci.carLeftConditions(car)) { var from = this.getFromWhenAction(player, car); var to = ci.target; var fp1 = Program.dt.GetFpByIndex(from); //var fp2 = Program.dt.GetFpByIndex(to); //var baseFp = Program.dt.GetFpByIndex(player.StartFPIndex); var goPath = that.GetAFromB_v2(from, to, player, ref notifyMsg); //var returnPath = Program.dt.GetAFromB(fp2, baseFp.FastenPositionID); //var returnPath = Program.dt.GetAFromB(to, player.StartFPIndex); var returnPath = that.GetAFromB_v2(to, player.StartFPIndex, player, ref notifyMsg); var goMile = that.GetMile(goPath); var returnMile = that.GetMile(returnPath); //第一步,计算去程和回程。 if (car.ability.leftMile >= goMile + returnMile) { int startT; this.EditCarStateWhenActionStartOK(player, ref car, to, fp1, goPath, ref notifyMsg, out startT); ci.SetArrivalThread(startT, car, goMile, goPath, commandWithTime.ReturningOjb.ojbWithoutBoss(returnPath)); // getAllCarInfomations(sa.Key, ref notifyMsg); Mrr = MileResultReason.Abundant; return(commandWithTime.ReturningOjb.ojbWithoutBoss(returnPath)); } else if (car.ability.leftMile >= goMile) { Mrr = MileResultReason.CanNotReturn; return(player.returningOjb); } else { Mrr = MileResultReason.CanNotReach; return(player.returningOjb); } } else { Mrr = MileResultReason.MoneyIsNotEnougt; this.WebNotify(player, "你身上的剩余业务空间不够啦!"); return(player.returningOjb); } } else { Mrr = MileResultReason.NearestIsMoneyWhenAttack; this.WebNotify(player, $"离【{victimOrBeneficiary.PlayerName}】最近的是[{fpResult.FastenPositionName}]处的钱,不是你的车,攻击失败!"); that.ViewPosition(player, fpResult, ref notifyMsg); return(player.returningOjb); } } else { throw new Exception("准备运行条件里没有筛查?"); } } }
RoomMainF.RoomMain.commandWithTime.ReturningOjb collect(RoleInGame player, Car car, SetCollect sc, ref List <string> notifyMsg, out MileResultReason Mrr) { if (player.confuseRecord.IsBeingControlled()) { if (player.confuseRecord.getControlType() == Manager_Driver.ConfuseManger.ControlAttackType.Lost) { Model.FastonPosition target; if (car.state == CarState.waitOnRoad) { target = Program.dt.GetFpByIndex(car.targetFpIndex); } else if (car.state == CarState.waitAtBaseStation) { target = Program.dt.GetFpByIndex(player.StartFPIndex); } else { throw new Exception(""); } var positions = that.getCollectPositionsByDistance(target); if (sc.collectIndex == positions[0] || sc.collectIndex == positions[1]) { } else { var position0 = Program.dt.GetFpByIndex(that._collectPosition[positions[0]]); var position1 = Program.dt.GetFpByIndex(that._collectPosition[positions[1]]); var distance0 = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(target.Latitde, target.Longitude, position0.Latitde, position0.Longitude); var distance1 = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(target.Latitde, target.Longitude, position1.Latitde, position1.Longitude); if (distance0 < distance1) { this.WebNotify(player, $"您处于迷失状态,未能到达远方!只能先到附近的[{position0.FastenPositionName}]执行收集任务!"); var newSc = new SetCollect() { c = "SetCollect", collectIndex = positions[0], fastenpositionID = position0.FastenPositionID, cType = "findWork", Key = sc.Key }; return(collect(player, car, newSc, ref notifyMsg, out Mrr)); } else { this.WebNotify(player, $"您处于迷失状态,未能到达远方!只能先到附近的[{position1.FastenPositionName}]执行收集任务!"); var newSc = new SetCollect() { c = "SetCollect", collectIndex = positions[1], fastenpositionID = position1.FastenPositionID, cType = "findWork", Key = sc.Key }; return(collect(player, car, newSc, ref notifyMsg, out Mrr)); } } //var target = Program.dt.GetFpByIndex(victim.StartFPIndex); //var collectIndexTarget = that.getCollectPositionsByDistance(target)[randomValue]; } } RoleInGame boss; if (player.HasTheBoss(roomMain._Players, out boss)) { return(collectPassBossAddress(player, boss, car, sc, ref notifyMsg, out Mrr)); //return promotePassBossAddress(player, boss, car, sp, ref notifyMsg, out reason); } else { if (car.ability.leftVolume > 0) { var from = this.GetFromWhenUpdateCollect(that._Players[sc.Key], sc.cType, car); var to = getCollectPositionTo(sc.collectIndex);// this.promoteMilePosition; var fp1 = Program.dt.GetFpByIndex(from); var fp2 = Program.dt.GetFpByIndex(to); var fbBase = Program.dt.GetFpByIndex(player.StartFPIndex); //var goPath = Program.dt.GetAFromB(fp1, fp2.FastenPositionID); //var goPath = Program.dt.GetAFromB(from, to); var goPath = that.GetAFromB_v2(from, to, player, ref notifyMsg); //var returnPath = Program.dt.GetAFromB(to, player.StartFPIndex); var returnPath = that.GetAFromB_v2(to, player.StartFPIndex, player, ref notifyMsg); var goMile = that.GetMile(goPath); var returnMile = that.GetMile(returnPath); if (car.ability.leftMile >= goMile + returnMile) { int startT; this.EditCarStateWhenActionStartOK(player, ref car, to, fp1, goPath, ref notifyMsg, out startT); var ro = commandWithTime.ReturningOjb.ojbWithoutBoss(returnPath); // Thread th=new Thread() { } car.setState(player, ref notifyMsg, CarState.working); StartArriavalThread(startT, 0, player, car, sc, ro, goMile, goPath); //if (player.playerType == RoleInGame.PlayerType.NPC) // StartArriavalThread(startT, car, sc, ro, goMile); //else // StartArriavalThread(startT, car, sc, ro, goMile); // StartSelectThread(0, startT, car, sc, ro, goMile, goPath); // getAllCarInfomations(sc.Key, ref notifyMsg); Mrr = MileResultReason.Abundant;//返回原因 return(ro); } else if (car.ability.leftMile >= goMile) { // printState(player, car, $"剩余里程为{car.ability.leftMile}去程{goMile},回程{returnMile},你去了回不来。所以安排返回"); Mrr = MileResultReason.CanNotReturn; return(player.returningOjb); } else { // printState(player, car, $"剩余里程为{car.ability.leftMile}去程{goMile},回程{returnMile},去不了。所以安排返回"); Mrr = MileResultReason.CanNotReach; return(player.returningOjb); // return false; } } else { Mrr = MileResultReason.MoneyIsNotEnougt; this.WebNotify(player, "你身上的剩余收集空间不够啦!"); return(player.returningOjb); } } }