Пример #1
0
        public void ResetOnlineGuildDailyGPScheduleFunc()
        {
            HeroesDataContext  heroesDataContext = new HeroesDataContext();
            List <long>        list = new List <long>(this.OnlineGuildIDList);
            GuildGainGPMessage guildGainGPMessage = new GuildGainGPMessage(0L);

            foreach (long id in list)
            {
                IEntity entityByID = base.GetEntityByID(id);
                if (entityByID != null && !entityByID.IsClosed)
                {
                    GuildEntity guildEntity = entityByID.Tag as GuildEntity;
                    if (entityByID != null)
                    {
                        heroesDataContext.ResetInGameGuildDailyGainGP(guildEntity.GuildSN);
                        guildEntity.GuildInfo.DailyGainGP.Clear();
                        guildGainGPMessage.GuildPoint = guildEntity.GuildInfo.GuildPoint;
                        foreach (OnlineGuildMember onlineGuildMember in guildEntity.OnlineMembers.Values)
                        {
                            onlineGuildMember.RequestFrontendOperation(SendPacket.Create <GuildGainGPMessage>(guildGainGPMessage));
                        }
                    }
                }
            }
            DateTime d = GuildContents.GetPrevDailyGPResetTime() + TimeSpan.FromDays(1.0);

            this.DailyGPResetScheduleID = Scheduler.Schedule(JobProcessor.Current, Job.Create(new Action(this.ResetOnlineGuildDailyGPScheduleFunc)), d - DateTime.UtcNow + TimeSpan.FromSeconds(30.0));
        }
Пример #2
0
 public void ReportExtendSlot(string name, int amount)
 {
     try
     {
         using (HeroesDataContext heroesDataContext = new HeroesDataContext())
         {
             heroesDataContext.AddGuildStorageBriefLog(new int?(this.Parent.GuildSN), name, new byte?(3), new int?(1), new int?(0));
         }
     }
     catch (Exception ex)
     {
         Log <GuildStorageManager> .Logger.Error(ex);
     }
     this.QueryStorageLog(false);
 }
Пример #3
0
 public void UpdateSetting(int goldLimit, long accessTag)
 {
     try
     {
         using (HeroesDataContext heroesDataContext = new HeroesDataContext())
         {
             heroesDataContext.SetGuildStorageSetting(new int?(this.Parent.GuildSN), new int?(goldLimit), new long?(accessTag));
             this.GoldPickLimit  = goldLimit;
             this.AccessLimitTag = accessTag;
         }
     }
     catch (Exception ex)
     {
         Log <GuildStorageManager> .Logger.Error(ex);
     }
 }
Пример #4
0
        public void SetGroupMemberInfo(HeroesGuildMemberInfo groupMemberInfo, HeroesDataContext context)
        {
            this.HeroesGuildMemberInfo = groupMemberInfo;
            string text = groupMemberInfo.CharacterName.RemoveServerHeader();
            GetCharacterInfoByName getCharacterInfoByName = context.GetCharacterInfoByName(text).FirstOrDefault <GetCharacterInfoByName>();
            int      level = (getCharacterInfoByName == null) ? 0 : getCharacterInfoByName.Level;
            long     cid   = (getCharacterInfoByName == null) ? -1L : getCharacterInfoByName.ID;
            long     guildCharacterPoint = context.GetGuildCharacterPoint(cid);
            DateTime?dateTime            = null;

            context.GetLatestConnectedDateByName(text, ref dateTime);
            DateTime lastLoginTime = (dateTime == null || dateTime == null) ? DateTime.UtcNow : dateTime.Value;

            this.Key             = new GuildMemberKey(cid, (int)groupMemberInfo.CharacterSN, groupMemberInfo.NexonSN, text);
            this.GuildMemberInfo = new GuildMemberInfo(text, level, groupMemberInfo.emGroupUserType.ToGuildMemberRank(), guildCharacterPoint, lastLoginTime, this.Parent.OnlineMembers.ContainsKey(text));
        }
Пример #5
0
 public void ReportPickItem(string name, string itemclass, int amount, int color1, int color2, int color3)
 {
     try
     {
         using (HeroesDataContext heroesDataContext = new HeroesDataContext())
         {
             if (itemclass == "gold")
             {
                 heroesDataContext.AddGuildStorageBriefLog(new int?(this.Parent.GuildSN), name, new byte?(1), new int?(0), new int?(amount));
             }
             else
             {
                 heroesDataContext.AddGuildStorageBriefLog(new int?(this.Parent.GuildSN), name, new byte?(2), new int?(0), new int?(1));
                 heroesDataContext.AddGuildStorageItemLog(new int?(this.Parent.GuildSN), name, new byte?(0), itemclass, new int?(amount), new int?(color1), new int?(color2), new int?(color3));
             }
         }
     }
     catch (Exception ex)
     {
         Log <GuildStorageManager> .Logger.Error(ex);
     }
     this.QueryStorageLog(false);
 }
Пример #6
0
 public void QueryStorageLog(bool reloadOldLog)
 {
     reloadOldLog |= (DateTime.Now.Date != this.LastLogCrawl.Date);
     using (HeroesDataContext heroesDataContext = new HeroesDataContext())
     {
         ISingleResult <GetGuildStorageBriefLogsToday> guildStorageBriefLogsToday = heroesDataContext.GetGuildStorageBriefLogsToday(new int?(this.Parent.GuildSN));
         this.BriefTodayLogs.Clear();
         foreach (GetGuildStorageBriefLogsToday getGuildStorageBriefLogsToday in guildStorageBriefLogsToday)
         {
             GuildStorageBriefLogElement item = new GuildStorageBriefLogElement
             {
                 CharacterName = getGuildStorageBriefLogsToday.CharacterName,
                 OperationType = (GuildStorageOperationType)getGuildStorageBriefLogsToday.OperationType,
                 AddCount      = getGuildStorageBriefLogsToday.AddCount,
                 PickCount     = getGuildStorageBriefLogsToday.PickCount,
                 Datestamp     = getGuildStorageBriefLogsToday.Datestamp,
                 Timestamp     = getGuildStorageBriefLogsToday.Timestamp
             };
             this.BriefTodayLogs.Add(item);
         }
         ISingleResult <GetGuildStorageItemLogsToday> guildStorageItemLogsToday = heroesDataContext.GetGuildStorageItemLogsToday(new int?(this.Parent.GuildSN));
         this.ItemTodayLogs.Clear();
         foreach (GetGuildStorageItemLogsToday getGuildStorageItemLogsToday in guildStorageItemLogsToday)
         {
             GuildStorageItemLogElement item2 = new GuildStorageItemLogElement
             {
                 CharacterName = getGuildStorageItemLogsToday.CharacterName,
                 IsAddItem     = (getGuildStorageItemLogsToday.OperationType == 1),
                 ItemClass     = getGuildStorageItemLogsToday.ItemClass,
                 Count         = getGuildStorageItemLogsToday.Count,
                 Datestamp     = getGuildStorageItemLogsToday.Datestamp,
                 Timestamp     = getGuildStorageItemLogsToday.Timestamp,
                 Color1        = getGuildStorageItemLogsToday.Color1,
                 Color2        = getGuildStorageItemLogsToday.Color2,
                 Color3        = getGuildStorageItemLogsToday.Color3
             };
             this.ItemTodayLogs.Add(item2);
         }
         if (reloadOldLog)
         {
             this.LastLogCrawl = DateTime.Now;
             heroesDataContext.RemoveOldGuildStorageLog(new int?(this.Parent.GuildSN));
             ISingleResult <GetGuildStorageBriefLogs> guildStorageBriefLogs = heroesDataContext.GetGuildStorageBriefLogs(new int?(this.Parent.GuildSN));
             this.BriefOldLogs.Clear();
             foreach (GetGuildStorageBriefLogs getGuildStorageBriefLogs in guildStorageBriefLogs)
             {
                 GuildStorageBriefLogElement item3 = new GuildStorageBriefLogElement
                 {
                     CharacterName = getGuildStorageBriefLogs.CharacterName,
                     OperationType = (GuildStorageOperationType)getGuildStorageBriefLogs.OperationType,
                     AddCount      = getGuildStorageBriefLogs.AddCount,
                     PickCount     = getGuildStorageBriefLogs.PickCount,
                     Datestamp     = getGuildStorageBriefLogs.Datestamp,
                     Timestamp     = getGuildStorageBriefLogs.Timestamp
                 };
                 this.BriefOldLogs.Add(item3);
             }
             ISingleResult <GetGuildStorageItemLogs> guildStorageItemLogs = heroesDataContext.GetGuildStorageItemLogs(new int?(this.Parent.GuildSN));
             this.ItemOldLogs.Clear();
             foreach (GetGuildStorageItemLogs getGuildStorageItemLogs in guildStorageItemLogs)
             {
                 GuildStorageItemLogElement item4 = new GuildStorageItemLogElement
                 {
                     CharacterName = getGuildStorageItemLogs.CharacterName,
                     IsAddItem     = (getGuildStorageItemLogs.OperationType == 1),
                     ItemClass     = getGuildStorageItemLogs.ItemClass,
                     Count         = getGuildStorageItemLogs.Count,
                     Datestamp     = getGuildStorageItemLogs.Datestamp,
                     Timestamp     = getGuildStorageItemLogs.Timestamp,
                     Color1        = getGuildStorageItemLogs.Color1,
                     Color2        = getGuildStorageItemLogs.Color2,
                     Color3        = getGuildStorageItemLogs.Color3
                 };
                 this.ItemOldLogs.Add(item4);
             }
             this.BroadCastStorageLog(false);
         }
     }
     this.BroadCastStorageLog(true);
 }
Пример #7
0
        public GuildStorageManager(GuildEntity parent)
        {
            GuildStorageManager slotCount = this;

            if (!FeatureMatrix.IsEnable("GuildStorage"))
            {
                return;
            }
            this.Parent   = parent;
            this.SlotInfo = null;
            GuildService instance = GuildService.Instance;
            IEntity      entity   = this.Parent.Entity;
            Location     location = new Location()
            {
                ID       = (long)parent.GuildSN,
                Category = "PlayerService.PlayerService"
            };

            this.ItemConn       = instance.Connect(entity, location);
            this.StorageCount   = 0;
            this.Processing     = true;
            this.BriefTodayLogs = new List <GuildStorageBriefLogElement>();
            this.BriefOldLogs   = new List <GuildStorageBriefLogElement>();
            this.ItemTodayLogs  = new List <GuildStorageItemLogElement>();
            this.ItemOldLogs    = new List <GuildStorageItemLogElement>();
            JoinWithGuildInventory  joinWithGuildInventory = new JoinWithGuildInventory();
            QuildGuildStorageStatus quildGuildStorageStatu = new QuildGuildStorageStatus();

            this.LastLogCrawl = DateTime.MinValue;
            joinWithGuildInventory.OnComplete += new Action <Operation>((Operation __) => slotCount.RequestItemServiceOperation(quildGuildStorageStatu));
            joinWithGuildInventory.OnFail     += new Action <Operation>((Operation __) => this.Processing = false);
            quildGuildStorageStatu.OnComplete += new Action <Operation>((Operation __) =>
            {
                slotCount.StorageCount = quildGuildStorageStatu.Status.SlotCount;
                slotCount.ApplyStorage(quildGuildStorageStatu.Status.Inventory);
                slotCount.Processing = false;
                try
                {
                    using (HeroesDataContext heroesDataContext = new HeroesDataContext())
                    {
                        GetGuildStorageSetting getGuildStorageSetting = heroesDataContext.GetGuildStorageSetting(new int?(parent.GuildSN)).FirstOrDefault <GetGuildStorageSetting>();
                        if (getGuildStorageSetting != null)
                        {
                            slotCount.GoldPickLimit  = getGuildStorageSetting.GoldLimit;
                            slotCount.AccessLimitTag = getGuildStorageSetting.AccessLimitTag;
                        }
                        else
                        {
                            heroesDataContext.InitGuildStorageSetting(new int?(parent.GuildSN));
                        }
                    }
                }
                catch (Exception exception)
                {
                    Log <GuildStorageManager> .Logger.Error(exception);
                }
                slotCount.BroadCastInventoryInfo();
            });
            quildGuildStorageStatu.OnFail     += new Action <Operation>((Operation __) => this.Processing = false);
            this.ItemConn.ConnectionSucceeded += new EventHandler <EventArgs <IEntityProxy> >((object s, EventArgs <IEntityProxy> e) => slotCount.RequestItemServiceOperation(joinWithGuildInventory));
            this.QueryStorageLog(true);
        }
Пример #8
0
 public GuildMember(GuildEntity parent, HeroesGuildMemberInfo groupMemberInfo, HeroesDataContext context)
 {
     this.Parent = parent;
     this.SetGroupMemberInfo(groupMemberInfo, context);
 }