Example #1
0
 private void CreateShipHandler(NameValueCollection req)
 {
     int dockid = lastcreatedock = req.GetInt("api_kdock_id");
     BuildingDocks[dockid].IsLSC = req.GetInt("api_large_flag") != 0;
     BuildingDocks[dockid].Secretary = Staff.Current.Homeport.Secretary;
     BuildingDocks[dockid].HighSpeed = req.GetInt("api_highspeed");
     Logger.Loggers.MaterialLogger.ForceLog = true;
 }
Example #2
0
 private void NStartHandler(NameValueCollection req)
 {
     int shipid = req.GetInt("api_ship_id");
     inndock[req.GetInt("api_ndock_id") - 1] = shipid;
     if (req.GetInt("api_highspeed") != 0)
     {
         Staff.Current.Homeport.Ships[shipid].SetRepaired();
         Staff.Current.Homeport.Material.InstantRepair--;
     }
     Logger.Loggers.MaterialLogger.ForceLog = true;
 }
Example #3
0
 private void CheckQuestPage(NameValueCollection req, getmember_questlist api)
 {
     int checkfrom, checkto;
     int type = req.GetInt("api_tab_id");
     CycleCount();
     if (api.api_list == null)
     {
         if (api.api_disp_page == 1) AvilableQuests.Clear();
         OnAllPropertyChanged();
         return;
     }
     checkfrom = api.api_list.First().api_no;
     checkto = api.api_list.Last().api_no;
     if (api.api_disp_page == 1) checkfrom = int.MinValue;
     else if (lastcheckedpage == api.api_disp_page - 1) checkfrom = lastcheckedto + 1;
     if (api.api_disp_page == api.api_page_count) checkto = int.MaxValue;
     else if (lastcheckedpage == api.api_disp_page + 1) checkto = lastcheckedfrom - 1;
     IEnumerable<Quest> checkremovelist = null;
     switch (type)
     {
         case 0:
             checkremovelist = AvilableQuests;
             break;
         case 1:
             checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Daily);
             break;
         case 2:
             checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Weekly);
             break;
         case 3:
             checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Monthly);
             break;
         case 4:
             checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Once);
             break;
     }
     if (checkremovelist != null)
         foreach (var item in checkremovelist.Where(x => x.Id >= checkfrom && x.Id <= checkto).ToList())
             AvilableQuests.Remove(item);
     AvilableQuests.UpdateWithoutRemove(api.api_list, x => x.api_no);
     AvilableCount = api.api_count;
     InProgressCount = api.api_exec_count;
     lastcheckedpage = api.api_disp_page;
     lastcheckedfrom = checkfrom;
     lastcheckedto = checkto;
     lastcheckedtime = DateTimeOffset.UtcNow.ToOffset(QuestUpdateTime);
     UpdateInProgress();
     OnAllPropertyChanged();
 }
        /// <summary>
        /// Initializes the provider.
        /// </summary>
        /// <param name="name">The friendly name of the provider.</param>
        /// <param name="config">A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// The name of the provider is null.
        /// </exception>
        /// <exception cref="T:System.ArgumentException">
        /// The name of the provider has a length of zero.
        /// </exception>
        /// <exception cref="T:System.InvalidOperationException">
        /// An attempt is made to call <see cref="M:System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection)"/> on a provider after the provider has already been initialized.
        /// </exception>
        public override void Initialize(string name, NameValueCollection config) {
            base.Initialize(name, config);

            string defaultAppName = System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath;
            this.ApplicationName = config.GetString("applicationName", defaultAppName);

            // fecth provider settings
            _enablePasswordReset = config.GetBool("enablePasswordReset", true);
            _enablePasswordRetrieval = config.GetBool("enablePasswordRetrieval", false);
            _maxInvalidPasswordAttempts = config.GetInt("maxInvalidPasswordAttempts", 5);
            _minRequiredNonAlphanumericCharacters = config.GetInt("minRequiredNonAlphanumericCharacters", 0);
            _minRequiredPasswordLength = config.GetInt("minRequiredPasswordLength", 4);
            _passwordAttemptWindow = config.GetInt("passwordAttemptWindow", 10);
            _passwordFormat = config.GetEnum<MembershipPasswordFormat>("passwordFormat");
            _passwordStrengthRegularExpression = config.GetString("passwordStrengthRegularExpression", @"[\w| !§$%&/()=\-?\*]*");
            _requiresQuestionAndAnswer = config.GetBool("requiresQuestionAndAnswer", false);
            _requiresUniqueEmail = config.GetBool("requiresUniqueEmail", true);

            this.CaseSensitive = config.GetBool("caseSensitive", false);
            this.Comparer = this.CaseSensitive
                ? StringComparer.CurrentCulture : StringComparer.CurrentCultureIgnoreCase;
            this.Comparison = this.CaseSensitive
                    ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
            this.UseUniversalTime = config.GetBool("useUniversalTime", false);
        }
Example #5
0
 private void NSpeedChangeHandler(NameValueCollection req)
 {
     RepairDocks[req.GetInt("api_ndock_id")].Ship.SetRepaired();
     Staff.Current.Homeport.Material.InstantRepair--;
 }
Example #6
0
 private void KSpeedChangeHandler(NameValueCollection req)
 {
     var dock = BuildingDocks[req.GetInt("api_kdock_id")];
     dock.State = DockState.BuildComplete;
     dock.CompleteTime = DateTime.UtcNow;
     Staff.Current.Homeport.Material.InstantBuild -= dock.IsLSC ? 10 : 1;
 }
Example #7
0
 private void PowerUpHandler(NameValueCollection req, kaisou_powerup api)
 {
     foreach (int id in req.GetInts("api_id_items"))
     {
         Staff.Current.Homeport.RemoveShip(Staff.Current.Homeport.Ships[id]);
     }
     Staff.Current.Homeport.Ships[req.GetInt("api_id")].Update(api.api_ship);
     Staff.Current.Homeport.Fleets.UpdateWithoutRemove(api.api_deck, x => x.api_id);
 }
Example #8
0
 private void CreateItemHandler(NameValueCollection req, kousyou_createitem api)
 {
     var dev = new DevelopmentInfo { IsSuccess = api.api_create_flag != 0 };
     if (dev.IsSuccess)
     {
         Staff.Current.Homeport.Equipments.Add(new Equipment(api.api_slot_item));
         Staff.Current.Homeport.UpdateCounts();
         dev.Equip = Staff.Current.MasterData.EquipInfo[api.api_slot_item.api_slotitem_id];
     }
     else
     {
         dev.Equip = Staff.Current.MasterData.EquipInfo[int.Parse(api.api_fdata.Split(',')[1])];
     }
     Development.Insert(0, dev);
     Staff.Current.Homeport.Material.UpdateMaterial(api.api_material);
     Logger.Loggers.CreateItemLogger.Log(new Logger.CreateItemLog
     {
         DateTime = DateTime.UtcNow,
         SecretaryId = Staff.Current.Homeport.Secretary.ShipInfo.Id,
         SecretaryLevel = Staff.Current.Homeport.Secretary.Level,
         IsSuccess = dev.IsSuccess,
         AdmiralLevel = Staff.Current.Admiral.Level,
         EquipId = dev.Equip.Id,
         Item1 = req.GetInt("api_item1"),
         Item2 = req.GetInt("api_item2"),
         Item3 = req.GetInt("api_item3"),
         Item4 = req.GetInt("api_item4")
     });
     Logger.Loggers.MaterialLogger.ForceLog = true;
     Reporter.PoiDBReporter.ReportAsync(new JObject
     {
         ["items"] = new JArray
         {
             req.GetInt("api_item1"),
             req.GetInt("api_item2"),
             req.GetInt("api_item3"),
             req.GetInt("api_item4")
         },
         ["teitokuLv"] = Staff.Current.Admiral.Level,
         ["itemId"] = dev.Equip.Id,
         ["secretary"] = Staff.Current.Homeport.Secretary.ShipInfo.Id,
         ["successful"] = dev.IsSuccess
     }, "create_item");
 }
Example #9
0
 private void DestroyShipHandler(NameValueCollection req, kousyou_destroyship api)
 {
     Staff.Current.Homeport.RemoveShip(Staff.Current.Homeport.Ships[req.GetInt("api_ship_id")]);
     Staff.Current.Homeport.Material.UpdateMaterial(api.api_material);
 }
Example #10
0
 private void SelectRank(NameValueCollection req)
 {
     int mapid = req.GetInt("api_maparea_id") * 10 + req.GetInt("api_map_no");
     Staff.Current.MasterData.MapInfos[mapid].Difficulty = (EventMapDifficulty)req.GetInt("api_rank");
     Reporter.PoiDBReporter.ReportAsync(new JObject
     {
         ["teitokuLv"] = Staff.Current.Admiral.Level,
         ["teitokuId"] = Staff.Current.Admiral.MemberID,
         ["mapareaId"] = mapid,
         ["rank"] = req.GetInt("api_rank")
     }, "select_rank");
 }
Example #11
0
 private void ExchangeHandler(NameValueCollection req)
 {
     var ship = Ships[req.GetInt("api_id")];
     int src = req.GetInt("api_src_idx");
     int dst = req.GetInt("api_dst_idx");
     var item1 = ship.Slots[src].Item;
     var item2 = ship.Slots[dst].Item;
     ship.Slots[src].Item = item2;
     ship.Slots[dst].Item = item1;
     ship.UpdateStatus();
 }
Example #12
0
 private void PresetHandler(NameValueCollection req, getmember_deck api)
 {
     int deck = req.GetInt("api_deck_id");
     var fleet = Fleets[deck];
     fleet.Ships.ForEach(x => x.InFleet = null);
     fleet.Update(api);
 }
Example #13
0
 private void ChangeHandler(NameValueCollection api)
 {
     int idx = api.GetInt("api_ship_idx");
     int fleetid = api.GetInt("api_id");
     int shipid = api.GetInt("api_ship_id");
     var fleet = Fleets[fleetid];
     DispatcherHelper.UIDispatcher.Invoke(() =>
     {
         if (idx == -1)//旗艦以外全解除
         {
             for (int i = fleet.Ships.Count - 1; i > 0; i--)
             {
                 fleet.Ships[i].InFleet = null;
                 fleet.Ships.RemoveAt(i);
             }
         }
         else
         {
             if (shipid == -1)//はずす
             {
                 fleet.Ships[idx].InFleet = null;
                 fleet.Ships.RemoveAt(idx);
             }
             else
             {
                 var ship = Ships[shipid];
                 var destf = ship.InFleet;
                 if (idx < fleet.Ships.Count) fleet.Ships[idx].InFleet = destf;
                 if (destf != null)
                 {
                     if (idx < fleet.Ships.Count)
                         destf.Ships[destf.Ships.IndexOf(ship)] = fleet.Ships[idx];
                     else destf.Ships.Remove(ship);
                     destf.UpdateStatus();
                     if (destf != fleet && destf.Ships?.FirstOrDefault()?.ShipInfo.ShipType.Id == 19)
                         destf.CheckHomeportRepairingTime(true);
                 }
                 if (idx >= fleet.Ships.Count) fleet.Ships.Add(ship);
                 else fleet.Ships[idx] = ship;
                 ship.InFleet = fleet;
             }
             if (fleet.Ships?.FirstOrDefault()?.ShipInfo.ShipType.Id == 19)
                 fleet.CheckHomeportRepairingTime(true);
         }
         fleet.UpdateStatus();
     });
 }