public RegisterDSPartyResult Register(string quest, List <DSPlayerInfo> partyInfo, long microPlayID, long partyID, bool isGiantRaid, bool isAdultMode) { DSLog.AddLog(-1, quest, -1L, -1, "Register", partyInfo.Count.ToString()); string key = isGiantRaid ? quest : (this.DSStorage.CheckIsolateNormalQuest(quest) ? "isolate" : "normal"); DSWaitingQueue dswaitingQueue = this.QueueDict.TryGetValue(key); if (dswaitingQueue == null) { Log <DSWaitingSystem> .Logger.InfoFormat("[RegisterFail NoSuchQuest] quest:{0} microPlayID:{1} partyID:{2} partyCount:{3}", new object[] { quest, microPlayID, partyID, partyInfo.Count }); return(RegisterDSPartyResult.NoSuchQuest); } foreach (DSPlayerInfo dsplayerInfo in partyInfo) { if (this.DSPlayerDict.ContainsKey(dsplayerInfo.CID)) { Log <DSWaitingSystem> .Logger.InfoFormat("[RegisterFail AlreadyInQueue] quest:{0} microPlayID:{1} partyID:{2} partyCount:{3} cid:{4}", new object[] { quest, microPlayID, partyID, partyInfo.Count, dsplayerInfo.CID }); return(RegisterDSPartyResult.AlreadyInQueue); } } DSWaitingParty dswaitingParty = new DSWaitingParty(dswaitingQueue, partyInfo, quest, microPlayID, partyID, isGiantRaid, isAdultMode); foreach (DSPlayer dsplayer in dswaitingParty.Members.Values) { this.DSPlayerDict.Add(dsplayer.CID, dsplayer); } if (!dswaitingQueue.RegisterParty(dswaitingParty)) { foreach (DSPlayer dsplayer2 in dswaitingParty.Members.Values) { this.DSPlayerDict.Remove(dsplayer2.CID); Log <DSWaitingSystem> .Logger.InfoFormat("[RegisterFail CannotJoinQuest] quest:{0} microPlayID:{1} partyID:{2} partyCount:{3} cid:{4}", new object[] { quest, microPlayID, partyID, partyInfo.Count, dsplayer2.CID }); } dswaitingParty.Clear(); return(RegisterDSPartyResult.CannotJoinQuest); } return(RegisterDSPartyResult.Success); }
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); }