public static bool High16Low24(DSShip ship, Dictionary <long, DSPlayer> players) { int num = 0; int num2 = 0; foreach (DSPlayer dsplayer in ship.Players.Values.Concat(players.Values)) { if (dsplayer.Level >= 60) { num++; } else { num2++; } if (num > 16) { return(false); } if (num2 > 24) { return(false); } } return(true); }
public void RegisterShip(DSShip ship) { this.WaitingParty = null; this.Ship = ship; this.Status = ((ship.ShipState == DSShipState.Launched) ? ((this.IsGiantRaid && this.Ship.Players.Count < 16) ? DSPlayerStatus.ShipWaitingMember : DSPlayerStatus.ShipReady) : DSPlayerStatus.ShipLaunching); this.SyncDSStatus(); }
public void UnregisterPlayer(DSPlayer player) { if (player.WaitingParty != null) { DSWaitingParty waitingParty = player.WaitingParty; waitingParty.RemovePlayer(player); if (waitingParty.Members.Count == 0) { this.WaitingParties.Remove(waitingParty.Node); if (FeatureMatrix.IsEnable("DSDynamicLoad") && this.WaitingParties.Count == 0) { DSService.Instance.DSEntityMakerSystem.Dequeue(this.ID, this.DSType); } } this.Process(this.WaitingParties.First); return; } if (player.Ship != null) { DSShip ship = player.Ship; ship.RemovePlayer(player); if (ship.HasEmptySlot) { this.Process(this.WaitingParties.First); } } }
public void SinkShip(DSShip ship) { ship.ShipState = DSShipState.Finished; this.Parent.DSStorage.DSShipMap.Remove(ship.DSInfo.DSID); ship.Clear(); this.Ships.Remove(ship.Node); }
public override string ToString() { Dictionary <DSShipState, int> dictionary = new Dictionary <DSShipState, int>(); foreach (DSInfo dsinfo in this.DSMap.Values) { DSShip dsship = this.DSShipMap.TryGetValue(dsinfo.DSID); if (dsship == null) { dictionary.AddOrIncrease(DSShipState.Initial, 1); } else { dictionary.AddOrIncrease(dsship.ShipState, 1); } } int num = (from x in this.DSMap.Values where x.DSType == DSType.GiantRaid select x).Count <DSInfo>(); int num2 = (from x in this.DSMap.Values where x.DSType == DSType.Pvp select x).Count <DSInfo>(); StringBuilder stringBuilder = new StringBuilder("========ds storage======\n"); stringBuilder.AppendFormat("Total : {0}, Giant Raid {1} Pvp {2}\n", this.DSMap.Count, num, num2); foreach (KeyValuePair <DSShipState, int> keyValuePair in dictionary) { stringBuilder.AppendFormat("{0} : {1}", keyValuePair.Key, keyValuePair.Value); } return(stringBuilder.ToString()); }
public void DSShipSinked(int dsID, string failReason) { DSInfo dsinfo = this.DSStorage.DSMap.TryGetValue(dsID); if (dsinfo != null) { DSShip dsship = dsinfo.GetDSShip(); if (dsship != null) { DSLog.AddLog(dsinfo.DSID, dsinfo.GetDSShip().DSWaitingQueue.QuestID, dsinfo.GetDSShip().PartyID, -1, "DSShipSinked", failReason); foreach (KeyValuePair <long, DSPlayer> keyValuePair in dsship.Players) { this.DSPlayerDict.Remove(keyValuePair.Key); keyValuePair.Value.SendMessage <DSPlayerStatusMessage>(new DSPlayerStatusMessage("", DSPlayerStatus.Unregistered, failReason, keyValuePair.Value.IsGiantRaid)); } if (failReason != null) { Log <DSWaitingSystem> .Logger.ErrorFormat("DS Ship Sinked!!! : {0}", failReason); } dsship.DSWaitingQueue.SinkShip(dsship); if (ServiceCore.FeatureMatrix.IsEnable("DSDynamicLoad")) { return; } this.ProcessAll(); } } }
public static void SetDSShip(this DSInfo info, DSShip dsShip) { if (dsShip == null) { DSService.Instance.DSWaitingSystem.DSStorage.DSShipMap.Remove(info.DSID); return; } DSService.Instance.DSWaitingSystem.DSStorage.DSShipMap.Add(info.DSID, dsShip); }
public bool Step(ref LinkedListNode <DSWaitingParty> from) { if (this.WaitingParties.Count == 0 || from == null) { return(false); } bool flag = true; foreach (DSShip dsship in this.Ships) { if (dsship.HasEmptySlot) { flag = false; break; } } if (flag) { DSInfo waitingDS = this.Parent.DSStorage.GetWaitingDS(this.DSType); if (waitingDS == null) { if (FeatureMatrix.IsEnable("DSDynamicLoad")) { DSService.Instance.DSEntityMakerSystem.Enqueue(this.ID, this.DSType); } return(false); } DSShip dsship2 = new DSShip(this, waitingDS); dsship2.Node = this.Ships.AddLast(dsship2); } do { DSWaitingParty value = from.Value; from = from.Next; foreach (DSShip dsship3 in this.Ships) { if (dsship3.HasEmptySlot && dsship3.TryEnterShip(value)) { value.Clear(); this.WaitingParties.Remove(value); return(true); } } }while (from != null); DSInfo waitingDS2 = this.Parent.DSStorage.GetWaitingDS(this.DSType); if (waitingDS2 == null) { return(false); } DSShip dsship4 = new DSShip(this, waitingDS2); dsship4.Node = this.Ships.AddLast(dsship4); from = this.WaitingParties.First; return(true); }
public static bool NoConstraint(DSShip ship, Dictionary <long, DSPlayer> players) { return(true); }