Beispiel #1
0
        private async Task <bool> ChangeBetterStats(int techId)
        {
            if (asyncLock)
            {
                return(false);
            }
            try {
                asyncLock = true;
                if (instituteInfo == null)
                {
                    return(false);
                }
                var tech = instituteInfo.Techs.Find(item => item.Id == techId);
                if (tech.NewValue == 0)
                {
                    return(true);
                }
                if (tech.NewValue <= tech.Value)
                {
                    return(true);
                }
                messageLogModel.Log(String.Format("[SNC] {0}: {1} +{2}{3} => +{4}{5}",
                                                  tech.Name, tech.Desc, tech.Value, tech.ValueUnit, tech.NewValue, tech.ValueUnit));
                var p = await packetWriter.ChangeInstituteTechAsync(techId);

                if (p == null || p.HasError)
                {
                    return(false);
                }
                return(true);
            } finally {
                asyncLock = false;
            }
        }