Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void RemoveWaitingQueue(string quest)
        {
            DSWaitingQueue dswaitingQueue = this.QueueDict.TryGetValue(quest);

            if (dswaitingQueue != null)
            {
                dswaitingQueue.Clear();
                this.QueueDict.Remove(quest);
            }
        }
Esempio n. 3
0
 public DSShip(DSWaitingQueue queue, DSInfo ds)
 {
     this.DSWaitingQueue = queue;
     this.Players        = new Dictionary <long, DSPlayer>();
     this.ShipState      = DSShipState.Initial;
     this.GameState      = DSGameState.Initial;
     this.DSInfo         = ds;
     ds.SetDSShip(this);
     this.IsEnterable = DSShip_EnterFunc.GetEnterFunc(queue.QuestID);
     this.StartTime   = null;
     this.IsAdultMode = false;
 }
Esempio n. 4
0
 public DSWaitingParty(DSWaitingQueue parent, List <DSPlayerInfo> list, string questID, long microPlayID, long partyID, bool isGiantRaid, bool isAdultMode)
 {
     this.DSWaitingQueue = parent;
     this.Members        = new Dictionary <long, DSPlayer>();
     this.Order          = null;
     this.RegisteredTime = DateTime.UtcNow;
     this.QuestID        = questID;
     this.MicroPlayID    = microPlayID;
     this.PartyID        = partyID;
     this.IsGiantRaid    = isGiantRaid;
     this.IsAdultMode    = isAdultMode;
     foreach (DSPlayerInfo dsplayerInfo in list)
     {
         this.Members.Add(dsplayerInfo.CID, new DSPlayer(this, dsplayerInfo.CID, dsplayerInfo.FID, dsplayerInfo.Level, this.IsGiantRaid));
     }
 }