예제 #1
0
 public void Save(Alliance alliance)
 {
     Debugger.WriteLine("Starting saving clan " + alliance.GetAllianceName() + " from memory to database at " + DateTime.Now);
     using (var context = new ucsdbEntities(m_vConnectionString))
     {
         context.Configuration.AutoDetectChangesEnabled = false;
         context.Configuration.ValidateOnSaveEnabled    = false;
         var c = context.clan.Find((int)alliance.GetAllianceId());
         if (c != null)
         {
             c.LastUpdateTime       = DateTime.Now;
             c.Data                 = alliance.SaveToJSON();
             context.Entry(c).State = EntityState.Modified;
         }
         else
         {
             context.clan.Add(
                 new clan
             {
                 ClanId         = alliance.GetAllianceId(),
                 LastUpdateTime = DateTime.Now,
                 Data           = alliance.SaveToJSON()
             }
                 );
         }
         context.SaveChanges();
         Debugger.WriteLine("Finished saving clan " + alliance.GetAllianceName() + " from memory to database at " + DateTime.Now);
     }
 }
예제 #2
0
 public void Save(Alliance alliance)
 {
     using (ucsdbEntities context = new ucsdbEntities(m_vConnectionString))
     {
         context.Configuration.AutoDetectChangesEnabled = false;
         context.Configuration.ValidateOnSaveEnabled    = false;
         clan c = context.clan.Find((int)alliance.GetAllianceId());
         if (c != null)
         {
             c.LastUpdateTime       = DateTime.Now;
             c.Data                 = alliance.SaveToJSON();
             context.Entry(c).State = EntityState.Modified;
         }
         else
         {
             context.clan.Add(
                 new clan
             {
                 ClanId         = alliance.GetAllianceId(),
                 LastUpdateTime = DateTime.Now,
                 Data           = alliance.SaveToJSON()
             }
                 );
         }
         context.SaveChanges();
     }
 }
예제 #3
0
 public void SetAlliance(Alliance alliance)
 {
     if (alliance != null)
     {
         if (alliance.GetAllianceId() != null)
         {
             m_vHasAlliance  = true;
             m_vAllianceId   = alliance.GetAllianceId();
             m_vAllianceName = alliance.GetAllianceName();
             m_vAllianceIcon = alliance.GetAllianceBadgeData();
         }
     }
 }
        public void SetAlliance(Alliance alliance)
        {
            if (alliance == null || alliance.GetAllianceId() <= 0L)
            {
                // Just in case.
                m_vHasAlliance = false;
                return;
            }

            m_vHasAlliance  = true;
            m_vAllianceId   = alliance.GetAllianceId();
            m_vAllianceName = alliance.GetAllianceName();
            m_vAllianceIcon = alliance.GetAllianceBadgeData();
        }
        public async Task Save(Alliance alliance)
        {
            using (ucsdbEntities ctx = new ucsdbEntities(m_vConnectionString))
            {
                ctx.Configuration.AutoDetectChangesEnabled = false;
                ctx.Configuration.ValidateOnSaveEnabled    = false;
                clan c = await ctx.clan.FindAsync((int)alliance.GetAllianceId());

                if (c != null)
                {
                    c.LastUpdateTime   = DateTime.Now;
                    c.Data             = alliance.SaveToJson();
                    ctx.Entry(c).State = EntityState.Modified;
                }
                //else
                //{
                //    context.clan.Add(
                //        new clan
                //        {
                //            ClanId = alliance.GetAllianceId(),
                //            LastUpdateTime = DateTime.Now,
                //            Data = alliance.SaveToJSON()
                //        });
                //}
                await ctx.SaveChangesAsync();
            }
        }
예제 #6
0
        public override void Process(Level level)
        {
            //Clan creation
            Alliance alliance = ObjectManager.CreateAlliance(0);

            alliance.SetAllianceName(m_vAllianceName);
            alliance.SetAllianceDescription(m_vAllianceDescription);
            alliance.SetAllianceType(m_vAllianceType);
            alliance.SetRequiredScore(m_vRequiredScore);
            alliance.SetAllianceBadgeData(m_vAllianceBadgeData);
            //alliance.SetAllianceOrigin(m_vAllianceOrigin);
            alliance.SetWarFrequency(m_vWarFrequency);

            //Set player clan
            //ObjectManager.OnlinePlayers.TryGetValue(p.Client, out player);
            level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId());
            AllianceMemberEntry member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId());

            member.SetRole(2);
            alliance.AddAllianceMember(member);

            var joinAllianceCommand = new JoinAllianceCommand();

            joinAllianceCommand.SetAlliance(alliance);
            var availableServerCommandMessage = new AvailableServerCommandMessage(this.Client);

            availableServerCommandMessage.SetCommandId(1);
            availableServerCommandMessage.SetCommand(joinAllianceCommand);
            PacketManager.ProcessOutgoingPacket(availableServerCommandMessage);
        }
 public static void AddAllianceInMemory(List <Alliance> all)
 {
     for (int i = 0, allCount = all.Count; i < allCount; i++)
     {
         Alliance a = all[i];
         m_vInMemoryAlliances.TryAdd(a.GetAllianceId(), a);
     }
 }
예제 #8
0
 public void RemoveAlliance(Alliance alliance)
 {
     using (var db = new ucsdbEntities(m_vConnectionString))
     {
         db.clan.Remove(db.clan.Find((int)alliance.GetAllianceId()));
         db.SaveChanges();
     }
 }
예제 #9
0
        public override byte[] Encode()
        {
            var data = new List <byte>();

            data.AddInt64(m_vAlliance.GetAllianceId());
            data.AddInt32(m_vReason);
            data.AddInt32(-1);
            return(data.ToArray());
        }
        public override async void Encode()
        {
            try
            {            //var pl = Client.GetLevel().GetPlayerAvatar();
                Alliance an = await ObjectManager.GetAlliance(Client.GetLevel().GetPlayerAvatar().GetAllianceId());

                List <byte> data = new List <byte>();
                data.AddInt32(4);                         // 4 = Preperation Day; 5 = Battle Day; 6 = End of War
                data.AddInt32(3600);                      // Time left
                data.AddInt64(an.GetAllianceId());        // Alliance ID
                data.AddString(an.GetAllianceName());     // Alliance Name
                data.AddInt32(an.GetAllianceBadgeData()); // Alliance Badge Data
                data.AddInt32(an.GetAllianceLevel());     // Alliance Level
                data.AddInt32(10);                        // War Members

                int count = 0;
                foreach (AllianceMemberEntry a in an.GetAllianceMembers())
                {
                    Level l = await ResourcesManager.GetPlayer(a.GetAvatarId());

                    ClientAvatar pl = l.GetPlayerAvatar();

                    data.AddInt64(pl.GetAllianceId());    // Alliance ID
                    data.AddInt64(pl.GetId());            // Player ID
                    data.AddInt64(pl.GetCurrentHomeId()); // Current Home ID
                    data.AddString(pl.GetAvatarName());   // Player 1 Name // or pl.GetAvatarName()
                    data.AddInt32(0);                     //StarGivenUp
                    data.AddInt32(0);                     //Damage
                    data.AddInt32(0);                     //Unknown 1
                    data.AddInt32(0);                     //AttackUsed
                    data.AddInt32(0);                     //TotalDefence
                    data.AddInt32(3);                     //Gold Gain
                    data.AddInt32(3);                     //Elixir Gain
                    data.AddInt32(3);                     //DElixir Gain
                    data.AddInt32(101000);                //Gold Available
                    data.AddInt32(101000);                //Elixir Available
                    data.AddInt32(550);                   //DElixir Available
                    data.AddInt32(0);                     //OffencesWeight
                    data.AddInt32(0);                     //DefencesWeight
                    data.AddInt32(0);                     //Unknown2
                    data.AddInt32(pl.GetTownHallLevel()); //TownHall Level
                    data.AddInt32(count + 1);             // Map Position

                    count++;
                    if (count == 10)
                    {
                        break;
                    }
                }

                //data.AddRange("00-00-04-22-00-00-06-A7-00-00-00-03-00-00-00-0A-00-00-00-00-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-C7-D0-00-00-00-00-00-00-00-00-05-00-00-00-23-00-00-00-07-64-72-61-67-67-64-63-00-00-00-14-00-00-00-01-00-00-00-0E-00-7A-B1-BE-00-00-00-01-00-3D-09-08-00-00-00-03-00-00-00-2B-00-1C-06-38-00-00-00-34-00-5D-D2-41-00-00-00-34-00-5D-D2-41-00-00-00-05-5A-6F-75-6D-69-00-00-00-02-00-00-00-40-00-00-00-97-00-00-00-01-00-00-00-01-00-00-FD-E8-00-00-FD-E8-00-00-01-22-00-00-FA-00-00-00-FA-00-00-00-01-18-00-00-02-66-00-00-02-05-00-00-00-03-00-00-00-08-00-00-00-01-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-2B-01-00-00-00-00-07-51-AA-F8-00-00-00-00-00-00-00-03-00-00-00-19-00-00-00-0D-6E-20-69-6D-70-6F-72-74-65-20-67-64-63-00-00-00-19-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-02-00-3D-09-08-00-00-00-04-00-3D-09-05-00-00-00-06-00-00-00-2B-00-1C-06-38-00-00-00-40-00-5F-97-0D-00-00-00-40-00-5F-97-0D-00-00-00-06-64-72-69-76-65-72-00-00-00-02-00-00-00-34-00-00-00-65-00-00-00-02-00-00-00-03-00-01-A1-30-00-01-A1-30-00-00-01-BC-00-00-FA-00-00-00-FA-00-00-00-01-18-00-00-02-6A-00-00-01-FA-00-00-00-03-00-00-00-08-00-00-00-02-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-28-01-00-00-00-00-07-53-BC-55-00-00-00-00-00-00-00-04-00-00-00-1E-00-00-00-00-00-00-00-1E-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-01-00-3D-09-11-00-00-00-02-00-00-00-2B-00-1C-06-38-00-00-00-0F-00-79-FE-3C-00-00-00-0F-00-79-FE-3C-00-00-00-08-6D-61-68-64-69-20-4D-52-00-00-00-02-00-00-00-35-00-00-00-66-00-00-00-00-00-00-00-02-00-00-00-00-00-00-00-00-00-00-00-00-00-00-EA-60-00-00-EA-60-00-00-00-FA-00-00-01-DE-00-00-01-B6-00-00-00-03-00-00-00-08-00-00-00-03-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-19-01-00-00-00-00-07-52-17-46-00-00-00-00-00-00-00-03-00-00-00-19-00-00-00-00-00-00-00-19-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-02-00-3D-09-08-00-00-00-04-00-3D-09-05-00-00-00-06-00-00-00-2B-00-1C-06-38-00-00-00-0E-00-7A-B1-BE-00-00-00-0E-00-7A-B1-BE-00-00-00-08-64-69-6D-C3-A9-32-37-30-00-00-00-03-00-00-00-64-00-00-00-7E-00-00-00-01-00-00-00-01-00-00-AB-E0-00-00-AB-E0-00-00-00-8C-00-00-CB-20-00-00-CB-20-00-00-00-B4-00-00-01-34-00-00-01-34-00-00-00-03-00-00-00-07-00-00-00-04-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-23-01-00-00-00-00-07-54-85-62-00-00-00-00-00-00-00-03-00-00-00-19-00-00-00-08-64-72-61-67-20-62-61-6C-00-00-00-19-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-02-00-3D-09-08-00-00-00-04-00-3D-09-05-00-00-00-06-00-00-00-2B-00-1C-06-38-00-00-00-0C-00-30-4C-9C-00-00-00-0C-00-30-4C-9B-00-00-00-04-4B-6F-67-61-00-00-00-03-00-00-00-64-00-00-00-8F-00-00-00-00-00-00-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-94-70-00-00-94-70-00-00-00-64-00-00-00-B0-00-00-00-CE-00-00-00-03-00-00-00-06-00-00-00-05-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-1E-01-00-00-00-00-07-54-B7-B2-00-00-00-00-00-00-00-02-00-00-00-14-00-00-00-26-73-6F-72-63-69-65-72-20-65-74-20-61-72-20-68-65-72-20-33-20-6D-69-6E-20-6D-65-72-63-69-20-6C-65-73-20-67-61-72-73-00-00-00-14-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-01-00-3D-09-08-00-00-00-04-00-00-00-2B-00-1C-06-38-00-00-00-13-00-F5-83-60-00-00-00-13-00-F5-83-60-00-00-00-06-79-61-6E-6E-6F-75-00-00-00-03-00-00-00-64-00-00-00-88-00-00-00-02-00-00-00-03-00-01-30-B0-00-01-30-B0-00-00-00-C8-00-00-88-B8-00-00-88-B8-00-00-00-46-00-00-00-8B-00-00-00-B5-00-00-00-03-00-00-00-06-00-00-00-06-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-14-01-00-00-00-00-07-54-D6-23-00-00-00-00-00-00-00-02-00-00-00-14-00-00-00-07-62-61-6C-6C-6F-6E-20-00-00-00-14-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-01-00-3D-09-08-00-00-00-04-00-00-00-2B-00-1C-06-38-00-00-00-35-00-FE-56-BE-00-00-00-35-00-FE-56-BE-00-00-00-07-62-61-73-74-69-65-6E-00-00-00-02-00-00-00-59-00-00-00-B3-00-00-00-02-00-00-00-04-00-00-54-60-00-00-54-60-00-00-00-00-00-00-84-D0-00-00-84-D0-00-00-00-3C-00-00-00-62-00-00-00-AB-00-00-00-03-00-00-00-06-00-00-00-07-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-1D-01-00-00-00-00-07-54-D4-C5-00-00-00-00-00-00-00-02-00-00-00-14-00-00-00-00-00-00-00-14-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-01-00-3D-09-08-00-00-00-04-00-00-00-2B-00-1C-06-38-00-00-00-0E-01-04-64-66-00-00-00-0E-01-04-64-66-00-00-00-06-4E-61-68-69-64-61-00-00-00-03-00-00-00-64-00-00-00-64-00-00-00-00-00-00-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-42-68-00-00-42-68-00-00-00-00-00-00-00-1E-00-00-00-3A-00-00-00-03-00-00-00-04-00-00-00-08-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-1C-01-00-00-00-00-07-4F-C9-DE-00-00-00-00-00-00-00-01-00-00-00-0F-00-00-00-00-00-00-00-0F-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-03-00-3D-09-05-00-00-00-06-00-3D-09-05-00-00-00-06-00-3D-09-05-00-00-00-06-00-00-00-2B-00-1C-06-38-00-00-00-55-00-DE-48-32-00-00-00-55-00-DE-48-32-00-00-00-09-6B-61-6D-65-6C-64-69-6E-65-00-00-00-03-00-00-00-64-00-00-00-41-00-00-00-00-00-00-00-02-00-00-00-00-00-00-00-00-00-00-00-00-00-00-3E-80-00-00-3E-80-00-00-00-00-00-00-00-1D-00-00-00-33-00-00-00-03-00-00-00-04-00-00-00-09-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-1B-01-00-00-00-00-07-52-94-B1-00-00-00-00-00-00-00-01-00-00-00-0F-00-00-00-00-00-00-00-0F-00-00-00-01-00-00-00-00-00-7E-1C-30-00-00-00-03-00-3D-09-05-00-00-00-06-00-3D-09-05-00-00-00-06-00-3D-09-05-00-00-00-06-01-00-00-00-32-00-00-00-05-00-00-00-05-00-00-00-05-00-00-00-05-00-00-00-05-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-0A-00-00-00-19-00-00-00-32-00-00-00-28-00-00-00-3C-01-00-00-00-19-00-10-65-87-00-00-00-12-C5-9E-45-4B-C4-B0-4C-53-C4-B0-4E-C4-B0-5A-20-59-41-41-62-00-19-52-00-00-00-06-00-00-00-0A-00-00-00-19-00-10-65-87-00-00-00-25-00-2F-B5-0B-00-00-00-25-00-2F-B5-0B-00-00-00-0B-4D-5F-61-5F-4E-5F-59-5F-61-5F-4B-00-00-00-02-00-00-00-32-00-00-00-5E-00-00-00-02-00-00-00-01-00-01-90-00-00-01-90-00-00-00-01-C0-00-01-38-80-00-01-38-80-00-00-01-A4-00-00-03-42-00-00-03-B1-00-00-00-03-00-00-00-09-00-00-00-00-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-2C-01-00-00-00-00-07-4F-E9-69-00-00-00-00-00-00-00-04-00-00-00-1E-00-00-00-00-00-00-00-1E-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-28-00-1E-A1-C0-00-00-00-28-00-1E-A1-C0-00-00-00-0A-C3-96-7A-63-61-6E-37-30-39-31-00-00-00-01-00-00-00-3E-00-00-00-7D-00-00-00-02-00-00-00-01-00-01-83-80-00-01-83-80-00-00-01-A8-00-01-34-98-00-01-34-98-00-00-01-9A-00-00-02-C1-00-00-03-89-00-00-00-03-00-00-00-09-00-00-00-01-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-2D-01-00-00-00-00-07-50-1E-D4-00-00-00-00-00-00-00-04-00-00-00-1E-00-00-00-00-00-00-00-1A-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-3D-00-00-9A-9A-00-00-00-3D-00-00-9A-9A-00-00-00-0C-54-45-52-4D-C4-B0-4E-41-54-C3-96-52-00-00-00-01-00-00-00-39-00-00-00-77-00-00-00-01-00-00-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-01-01-D0-00-01-01-D0-00-00-01-2C-00-00-02-80-00-00-02-20-00-00-00-03-00-00-00-08-00-00-00-02-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-36-01-00-00-00-00-07-50-10-E8-00-00-00-00-00-00-00-04-00-00-00-1E-00-00-00-00-00-00-00-1A-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-01-00-39-28-18-00-00-00-01-00-39-28-18-00-00-00-08-4D-55-48-49-54-54-49-4E-00-00-00-02-00-00-00-41-00-00-00-97-00-00-00-02-00-00-00-01-00-01-8C-E0-00-01-8C-E0-00-00-01-8A-00-00-FD-E8-00-00-FD-E8-00-00-01-22-00-00-02-66-00-00-02-16-00-00-00-03-00-00-00-08-00-00-00-03-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-22-01-00-00-00-00-07-52-E5-DF-00-00-00-00-00-00-00-04-00-00-00-1E-00-00-00-00-00-00-00-1C-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-2F-00-24-94-DF-00-00-00-2F-00-24-94-DF-00-00-00-06-6B-61-79-61-70-61-00-00-00-03-00-00-00-64-00-00-00-84-00-00-00-02-00-00-00-01-00-00-E4-20-00-00-E4-20-00-00-00-88-00-00-C7-38-00-00-C7-38-00-00-00-B4-00-00-01-2F-00-00-01-33-00-00-00-03-00-00-00-07-00-00-00-04-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-34-01-00-00-00-00-07-54-81-29-00-00-00-00-00-00-00-03-00-00-00-19-00-00-00-00-00-00-00-16-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-16-00-8D-78-64-00-00-00-16-00-8D-78-64-00-00-00-09-44-61-6E-71-65-52-6F-75-53-00-00-00-03-00-00-00-64-00-00-00-76-00-00-00-02-00-00-00-01-00-00-D7-A0-00-00-D7-A0-00-00-00-68-00-00-AB-E0-00-00-AB-E0-00-00-00-8C-00-00-00-E2-00-00-00-F9-00-00-00-03-00-00-00-07-00-00-00-05-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-25-01-00-00-00-00-07-54-1E-56-00-00-00-00-00-00-00-02-00-00-00-14-00-00-00-00-00-00-00-14-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-4F-00-A8-25-CE-00-00-00-4F-00-A8-25-CE-00-00-00-06-45-4E-49-53-36-31-00-00-00-02-00-00-00-35-00-00-00-87-00-00-00-02-00-00-00-01-00-00-79-E0-00-00-79-E0-00-00-00-30-00-00-A7-F8-00-00-A7-F8-00-00-00-8C-00-00-00-C8-00-00-00-F1-00-00-00-03-00-00-00-07-00-00-00-06-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-1A-01-00-00-00-00-07-50-2E-DD-00-00-00-00-00-00-00-03-00-00-00-19-00-00-00-00-00-00-00-19-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-11-00-A0-BC-DF-00-00-00-11-00-A0-BC-DF-00-00-00-05-56-61-68-69-74-00-00-00-03-00-00-00-64-00-00-00-AF-00-00-00-02-00-00-00-02-00-00-A6-04-00-00-A6-04-00-00-00-3C-00-00-88-B8-00-00-88-B8-00-00-00-3C-00-00-00-93-00-00-00-B1-00-00-00-03-00-00-00-06-00-00-00-07-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-21-01-00-00-00-00-07-53-C7-48-00-00-00-00-00-00-00-02-00-00-00-14-00-00-00-00-00-00-00-14-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-0F-00-F4-54-9A-00-00-00-0F-00-F4-54-9A-00-00-00-04-5A-65-75-73-00-00-00-01-00-00-00-56-00-00-00-B3-00-00-00-02-00-00-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-69-78-00-00-69-78-00-00-00-00-00-00-00-4D-00-00-00-71-00-00-00-03-00-00-00-05-00-00-00-08-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-2A-01-00-00-00-00-07-51-17-5B-00-00-00-00-00-00-00-02-00-00-00-14-00-00-00-00-00-00-00-14-00-00-00-00-00-00-00-19-00-10-65-87-00-00-00-03-00-E4-7C-1C-00-00-00-03-00-E4-7C-1C-00-00-00-0A-6B-65-72-69-6D-20-62-61-62-61-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-01-00-00-00-00-00-00-3E-80-00-00-3E-80-00-00-00-00-00-00-2E-E0-00-00-2E-E0-00-00-00-00-00-00-00-13-00-00-00-23-00-00-00-03-00-00-00-03-00-00-00-09-02-00-00-00-57-00-2D-86-65-01-00-00-00-00-21-8E-B2-33-00-00-00-00-00-00-00-00-01-00-00-00-0F-00-00-00-00-00-00-00-0F-00-00-00-00-01-00-00-00-32-00-00-00-05-00-00-00-05-00-00-00-05-00-00-00-05-00-00-00-05-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-04-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-03-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-02-00-00-00-0A-00-00-00-19-00-00-00-32-00-00-00-28-00-00-00-3C-01-00-00-00-57-00-2D-86-65-00-00-00-1C-00-00-00-01-00-00-00-00-07-54-D6-23-00-00-1A-01-00-00-00-19-00-10-65-87-00-00-00-2F-00-24-94-DF-00-00-00-2B-00-1C-06-38-00-00-00-13-00-F5-83-60-00-00-00-06-6B-61-79-61-70-61-00-00-00-06-79-61-6E-6E-6F-75-00-00-00-03-00-00-00-01-00-00-00-64-00-00-00-88-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-2F-00-00-00-00-80-CD-90-A3-00-04-F4-57-00-00-00-01-00-00-00-00-07-54-D4-C5-00-00-1A-6C-00-00-00-19-00-10-65-87-00-00-00-16-00-8D-78-64-00-00-00-2B-00-1C-06-38-00-00-00-35-00-FE-56-BE-00-00-00-09-44-61-6E-71-65-52-6F-75-53-00-00-00-07-62-61-73-74-69-65-6E-00-00-00-02-00-00-00-00-00-00-00-59-00-00-00-B3-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-16-00-00-00-00-A2-4E-64-65-00-02-F2-E2-00-00-00-01-00-00-00-00-07-54-B7-B2-00-00-23-04-00-00-00-19-00-10-65-87-00-00-00-2F-00-24-94-DF-00-00-00-2B-00-1C-06-38-00-00-00-0C-00-30-4C-9C-00-00-00-06-6B-61-79-61-70-61-00-00-00-04-4B-6F-67-61-00-00-00-03-00-00-00-03-00-00-00-64-00-00-00-8F-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-2F-00-00-00-00-80-CC-94-F8-00-04-F4-AC-00-00-00-01-00-00-00-00-07-54-85-62-00-00-30-BE-00-00-00-19-00-10-65-87-00-00-00-01-00-39-28-18-00-00-00-2B-00-1C-06-38-00-00-00-0E-00-7A-B1-BE-00-00-00-08-4D-55-48-49-54-54-49-4E-00-00-00-08-64-69-6D-C3-A9-32-37-30-00-00-00-03-00-00-00-03-00-00-00-64-00-00-00-7E-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-01-00-00-00-00-D8-A0-31-7B-00-04-E7-05-00-00-00-01-00-00-00-00-07-54-81-29-00-00-31-D3-00-00-00-2B-00-1C-06-38-00-00-00-40-00-5F-97-0D-00-00-00-19-00-10-65-87-00-00-00-2F-00-24-94-DF-00-00-00-06-64-72-69-76-65-72-00-00-00-06-6B-61-79-61-70-61-00-00-00-03-00-00-00-03-00-00-00-64-00-00-00-84-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-40-00-00-00-00-61-81-29-8F-00-05-97-AE-00-00-00-01-00-00-00-00-07-54-64-74-00-00-38-F2-00-00-00-19-00-10-65-87-00-00-00-4F-00-A8-25-CE-00-00-00-2B-00-1C-06-38-00-00-00-35-00-FE-56-BE-00-00-00-06-45-4E-49-53-36-31-00-00-00-07-62-61-73-74-69-65-6E-00-00-00-01-00-00-00-00-00-00-00-46-00-00-00-B3-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-4F-00-00-00-00-2F-81-00-E5-00-02-A5-49-00-00-00-01-00-00-00-00-07-54-1E-56-00-00-48-D2-00-00-00-2B-00-1C-06-38-00-00-00-0E-00-7A-B1-BE-00-00-00-19-00-10-65-87-00-00-00-16-00-8D-78-64-00-00-00-08-64-69-6D-C3-A9-32-37-30-00-00-00-09-44-61-6E-71-65-52-6F-75-53-00-00-00-03-00-00-00-03-00-00-00-64-00-00-00-76-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-0E-00-00-00-00-B0-1C-43-61-00-06-37-40-00-00-00-01-00-00-00-00-07-53-C7-AD-00-00-59-6C-00-00-00-19-00-10-65-87-00-00-00-16-00-8D-78-64-00-00-00-2B-00-1C-06-38-00-00-00-13-00-F5-83-60-00-00-00-09-44-61-6E-71-65-52-6F-75-53-00-00-00-06-79-61-6E-6E-6F-75-00-00-00-02-00-00-00-02-00-00-00-55-00-00-00-6B-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-16-00-00-00-00-A2-45-FE-F2-00-02-F2-E2-00-00-00-01-00-00-00-00-07-53-C7-48-00-00-59-7D-00-00-00-2B-00-1C-06-38-00-00-00-13-00-F5-83-60-00-00-00-19-00-10-65-87-00-00-00-11-00-A0-BC-DF-00-00-00-06-79-61-6E-6E-6F-75-00-00-00-05-56-61-68-69-74-00-00-00-03-00-00-00-03-00-00-00-64-00-00-00-AF-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-13-00-00-00-00-A4-34-4F-4C-00-03-A0-84-00-00-00-01-00-00-00-00-07-53-BC-55-00-00-5B-72-00-00-00-19-00-10-65-87-00-00-00-28-00-1E-A1-C0-00-00-00-2B-00-1C-06-38-00-00-00-40-00-5F-97-0D-00-00-00-0A-C3-96-7A-63-61-6E-37-30-39-31-00-00-00-06-64-72-69-76-65-72-00-00-00-02-00-00-00-01-00-00-00-34-00-00-00-65-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-28-00-00-00-00-96-A6-3F-E0-00-08-1F-1A-00-00-00-01-00-00-00-00-07-53-56-F7-00-00-6C-94-00-00-00-19-00-10-65-87-00-00-00-25-00-2F-B5-0B-00-00-00-2B-00-1C-06-38-00-00-00-40-00-5F-97-0D-00-00-00-0B-4D-5F-61-5F-4E-5F-59-5F-61-5F-4B-00-00-00-06-64-72-69-76-65-72-00-00-00-01-00-00-00-01-00-00-00-48-00-00-00-B3-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-25-00-00-00-00-96-B1-D6-69-00-06-0F-A4-00-00-00-01-00-00-00-00-07-53-29-23-00-00-73-FF-00-00-00-19-00-10-65-87-00-00-00-0F-00-F4-54-9A-00-00-00-2B-00-1C-06-38-00-00-00-35-00-FE-56-BE-00-00-00-04-5A-65-75-73-00-00-00-07-62-61-73-74-69-65-6E-00-00-00-00-00-00-00-00-00-00-00-23-00-00-00-AC-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-0F-00-00-00-00-B0-AD-E6-28-00-01-18-3C-00-00-00-01-00-00-00-00-07-53-22-D3-00-00-74-FF-00-00-00-19-00-10-65-87-00-00-00-0F-00-F4-54-9A-00-00-00-2B-00-1C-06-38-00-00-00-13-00-F5-83-60-00-00-00-04-5A-65-75-73-00-00-00-06-79-61-6E-6E-6F-75-00-00-00-00-00-00-00-00-00-00-00-25-00-00-00-99-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-0F-00-00-00-00-B0-AD-B7-C3-00-01-18-3C-00-00-00-01-00-00-00-00-07-52-E5-DF-00-00-7E-E7-00-00-00-2B-00-1C-06-38-00-00-00-34-00-5D-D2-41-00-00-00-19-00-10-65-87-00-00-00-01-00-39-28-18-00-00-00-05-5A-6F-75-6D-69-00-00-00-08-4D-55-48-49-54-54-49-4E-00-00-00-02-00-00-00-02-00-00-00-41-00-00-00-97-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-34-00-00-00-00-76-87-10-87-00-05-92-7C-00-00-00-01-00-00-00-00-07-52-94-B1-00-00-8D-42-00-00-00-19-00-10-65-87-00-00-00-4F-00-A8-25-CE-00-00-00-2B-00-1C-06-38-00-00-00-55-00-DE-48-32-00-00-00-06-45-4E-49-53-36-31-00-00-00-09-6B-61-6D-65-6C-64-69-6E-65-00-00-00-03-00-00-00-01-00-00-00-64-00-00-00-41-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-4F-00-00-00-00-2F-74-5A-11-00-00-F8-D4-00-00-00-01-00-00-00-00-07-52-78-80-00-00-92-AB-00-00-00-19-00-10-65-87-00-00-00-3D-00-00-9A-9A-00-00-00-2B-00-1C-06-38-00-00-00-40-00-5F-97-0D-00-00-00-0C-54-45-52-4D-C4-B0-4E-41-54-C3-96-52-00-00-00-06-64-72-69-76-65-72-00-00-00-00-00-00-00-00-00-00-00-23-00-00-00-53-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-3D-00-00-00-00-6B-33-88-9D-00-04-CD-AB-00-00-00-01-00-00-00-00-07-52-31-8B-00-00-A1-4D-00-00-00-2B-00-1C-06-38-00-00-00-35-00-FE-56-BE-00-00-00-19-00-10-65-87-00-00-00-11-00-A0-BC-DF-00-00-00-07-62-61-73-74-69-65-6E-00-00-00-05-56-61-68-69-74-00-00-00-00-00-00-00-00-00-00-00-21-00-00-00-41-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-35-00-00-00-00-76-83-0E-4E-00-01-7A-20-00-00-00-01-00-00-00-00-07-52-17-46-00-00-A7-38-00-00-00-19-00-10-65-87-00-00-00-28-00-1E-A1-C0-00-00-00-2B-00-1C-06-38-00-00-00-0F-00-79-FE-3C-00-00-00-0A-C3-96-7A-63-61-6E-37-30-39-31-00-00-00-08-6D-61-68-64-69-20-4D-52-00-00-00-02-00-00-00-01-00-00-00-35-00-00-00-66-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-28-00-00-00-00-96-99-53-BD-00-09-21-EE-00-00-00-01-00-00-00-00-07-51-AA-F8-00-00-C3-2B-00-00-00-19-00-10-65-87-00-00-00-25-00-2F-B5-0B-00-00-00-2B-00-1C-06-38-00-00-00-34-00-5D-D2-41-00-00-00-0B-4D-5F-61-5F-4E-5F-59-5F-61-5F-4B-00-00-00-05-5A-6F-75-6D-69-00-00-00-02-00-00-00-02-00-00-00-40-00-00-00-97-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-25-00-00-00-00-96-A3-E9-6C-00-07-EA-18-00-00-00-01-00-00-00-00-07-51-17-5B-00-00-EE-23-00-00-00-2B-00-1C-06-38-00-00-00-35-00-FE-56-BE-00-00-00-19-00-10-65-87-00-00-00-0F-00-F4-54-9A-00-00-00-07-62-61-73-74-69-65-6E-00-00-00-04-5A-65-75-73-00-00-00-01-00-00-00-01-00-00-00-56-00-00-00-B3-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-35-00-00-00-00-76-78-EE-65-00-01-7F-FC-00-00-00-01-00-00-00-00-07-50-2E-DD-00-01-2F-F7-00-00-00-2B-00-1C-06-38-00-00-00-13-00-F5-83-60-00-00-00-19-00-10-65-87-00-00-00-4F-00-A8-25-CE-00-00-00-06-79-61-6E-6E-6F-75-00-00-00-06-45-4E-49-53-36-31-00-00-00-02-00-00-00-02-00-00-00-35-00-00-00-87-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-13-00-00-00-00-A4-15-1E-DF-00-03-9E-F4-00-00-00-01-00-00-00-00-07-50-1E-D4-00-01-35-0E-00-00-00-2B-00-1C-06-38-00-00-00-00-00-7E-1C-30-00-00-00-19-00-10-65-87-00-00-00-28-00-1E-A1-C0-00-00-00-09-76-72-36-6C-65-76-72-61-69-00-00-00-0A-C3-96-7A-63-61-6E-37-30-39-31-00-00-00-01-00-00-00-01-00-00-00-3E-00-00-00-7D-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-00-00-00-00-00-DB-CE-2A-5E-00-06-5A-E0-00-00-00-01-00-00-00-00-07-50-10-E8-00-01-39-7C-00-00-00-2B-00-1C-06-38-00-00-00-40-00-5F-97-0D-00-00-00-19-00-10-65-87-00-00-00-3D-00-00-9A-9A-00-00-00-06-64-72-69-76-65-72-00-00-00-0C-54-45-52-4D-C4-B0-4E-41-54-C3-96-52-00-00-00-01-00-00-00-01-00-00-00-39-00-00-00-77-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-40-00-00-00-00-61-5D-9F-85-00-05-8E-FD-00-00-00-01-00-00-00-00-07-4F-F8-93-00-01-41-BD-00-00-00-19-00-10-65-87-00-00-00-03-00-E4-7C-1C-00-00-00-2B-00-1C-06-38-00-00-00-55-00-DE-48-32-00-00-00-0A-6B-65-72-69-6D-20-62-61-62-61-00-00-00-09-6B-61-6D-65-6C-64-69-6E-65-00-00-00-02-00-00-00-02-00-00-00-55-00-00-00-65-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-03-00-00-00-00-D7-23-05-36-00-00-2D-14-00-00-00-01-00-00-00-00-07-4F-F5-E2-00-01-42-AF-00-00-00-19-00-10-65-87-00-00-00-11-00-A0-BC-DF-00-00-00-2B-00-1C-06-38-00-00-00-35-00-FE-56-BE-00-00-00-05-56-61-68-69-74-00-00-00-07-62-61-73-74-69-65-6E-00-00-00-02-00-00-00-02-00-00-00-4B-00-00-00-99-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-11-00-00-00-00-AB-47-44-62-00-03-70-DC-00-00-00-01-00-00-00-00-07-4F-E9-69-00-01-46-EA-00-00-00-2B-00-1C-06-38-00-00-00-00-00-7E-1C-30-00-00-00-19-00-10-65-87-00-00-00-25-00-2F-B5-0B-00-00-00-09-76-72-36-6C-65-76-72-61-69-00-00-00-0B-4D-5F-61-5F-4E-5F-59-5F-61-5F-4B-00-00-00-02-00-00-00-02-00-00-00-32-00-00-00-5E-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-00-00-00-00-00-DB-CB-D5-4A-00-06-B2-D8-00-00-00-01-00-00-00-00-07-4F-DC-A5-00-01-4B-19-00-00-00-19-00-10-65-87-00-00-00-01-00-39-28-18-00-00-00-2B-00-1C-06-38-00-00-00-0F-00-79-FE-3C-00-00-00-08-4D-55-48-49-54-54-49-4E-00-00-00-08-6D-61-68-64-69-20-4D-52-00-00-00-01-00-00-00-01-00-00-00-47-00-00-00-8E-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-01-00-00-00-00-D8-73-F5-4C-00-05-54-F1-00-00-00-01-00-00-00-00-07-4F-C9-DE-00-01-50-FB-00-00-00-19-00-10-65-87-00-00-00-11-00-A0-BC-DF-00-00-00-2B-00-1C-06-38-00-00-00-0E-01-04-64-66-00-00-00-05-56-61-68-69-74-00-00-00-06-4E-61-68-69-64-61-00-00-00-03-00-00-00-03-00-00-00-64-00-00-00-64-00-00-00-08-00-00-01-4C-00-00-00-06-01-00-00-00-11-00-00-00-00-AB-45-9E-F3-00-01-4D-98".Replace("-", "").ToBytes());

                // TODO: Fix

                Encrypt(data.ToArray());
            } catch (Exception) { }
        }
예제 #11
0
        //00 00 00 02 00 00 00 3B 00 0A 40 1E 00 00 00 01 FF FF FF FF
        public override void Encode()
        {
            var pack = new List <byte>();

            pack.AddInt32(m_vServerCommandType);
            pack.AddInt64(m_vAlliance.GetAllianceId());
            pack.AddInt32(1); //reason? 1= leave, 2=kick
            pack.AddInt32(-1);
            Encrypt(pack.ToArray());
        }
        public override byte[] Encode()
        {
            List <byte> data = new List <byte>();

            data.AddInt64(m_vAlliance.GetAllianceId());
            data.AddInt32(Role);
            data.AddInt32(Role);
            data.AddInt32(0);
            return(data.ToArray());
        }
예제 #13
0
        /// <summary>
        ///     This function remove an alliance from database.
        /// </summary>
        /// <param name="alliance">The Alliance of the alliance.</param>
        public void RemoveAlliance(Alliance alliance)
        {
            long id = alliance.GetAllianceId();

            using (ucsdbEntities db = new ucsdbEntities(m_vConnectionString))
            {
                db.clan.Remove(db.clan.Find((int)id));
                db.SaveChanges();
            }
            ObjectManager.RemoveInMemoryAlliance(id);
        }
예제 #14
0
        public override byte[] Encode()
        {
            m_vPlayer.Tick();
            List <byte> data = new List <byte>();

            data.AddInt64(m_vAlliance.GetAllianceId());
            data.AddInt32(m_vAlliance.GetAllianceBadgeData());
            data.AddInt32(m_vAlliance.GetAllianceLevel());
            data.AddInt32(0); //Tick
            return(data.ToArray());
        }
예제 #15
0
        public void RemoveAlliance(Alliance alliance)
        {
            long allianceId = alliance.GetAllianceId();

            using (ucsdbEntities ucsdbEntities = new ucsdbEntities(this.m_vConnectionString))
            {
                ucsdbEntities.clan.Remove(ucsdbEntities.clan.Find(new object[]
                {
                    (int)allianceId
                }));
                ucsdbEntities.SaveChanges();
            }
            ObjectManager.RemoveInMemoryAlliance(allianceId);
        }
예제 #16
0
        /// <summary>
        ///     This function store a new alliance in the database.
        /// </summary>
        /// <param name="seed">The seed of the client.</param>
        /// <returns>The alliance data.</returns>
        /// <seealso cref="Alliance" />
        public static Alliance CreateAlliance(long seed)
        {
            Alliance alliance;

            lock (m_vDatabaseLock)
            {
                if (seed == 0)
                {
                    seed = m_vAllianceSeed;
                }
                alliance = new Alliance(seed);
                m_vAllianceSeed++;
            }
            m_vDatabase.CreateAlliance(alliance);
            m_vAlliances.Add(alliance.GetAllianceId(), alliance);
            return(alliance);
        }
예제 #17
0
        /// <summary>
        ///     This function get the info of an alliance.
        /// </summary>
        /// <param name="allianceId">The (Int64) ID of the alliance.</param>
        /// <returns>Return data about the alliance.</returns>
        public static Alliance GetAlliance(long allianceId)
        {
            Alliance alliance = null;

            if (m_vAlliances.ContainsKey(allianceId))
            {
                alliance = m_vAlliances[allianceId];
            }
            else
            {
                alliance = m_vDatabase.GetAlliance(allianceId);
                if (alliance != null)
                {
                    m_vAlliances.Add(alliance.GetAllianceId(), alliance);
                }
            }
            return(alliance);
        }
예제 #18
0
        public static Alliance CreateAlliance(long seed)
        {
            object   vDatabaseLock = ObjectManager.m_vDatabaseLock;
            Alliance alliance;

            lock (vDatabaseLock)
            {
                if (seed == 0L)
                {
                    seed = ObjectManager.m_vAllianceSeed;
                }
                alliance = new Alliance(seed);
                ObjectManager.m_vAllianceSeed += 1L;
            }
            ObjectManager.m_vDatabase.CreateAlliance(alliance);
            ObjectManager.m_vAlliances.Add(alliance.GetAllianceId(), alliance);
            return(alliance);
        }
예제 #19
0
 public void CreateAlliance(Alliance a)
 {
     try
     {
         using (ucsdbEntities ucsdbEntities = new ucsdbEntities(this.m_vConnectionString))
         {
             ucsdbEntities.clan.Add(new clan
             {
                 ClanId         = a.GetAllianceId(),
                 LastUpdateTime = DateTime.Now,
                 Data           = a.SaveToJSON()
             });
             ucsdbEntities.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debugger.WriteLine("[CRS]    An exception occured during CreateAlliance processing :", ex, 4);
     }
 }
예제 #20
0
 /// <summary>
 ///     This function create a new alliance in the database, with default parameters.
 /// </summary>
 /// <param name="a">The alliance data.</param>
 public void CreateAlliance(Alliance a)
 {
     try
     {
         using (ucsdbEntities db = new ucsdbEntities(m_vConnectionString))
         {
             db.clan.Add(
                 new clan
             {
                 ClanId         = a.GetAllianceId(),
                 LastUpdateTime = DateTime.Now,
                 Data           = a.SaveToJSON()
             }
                 );
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Logger.Write("Error when try to Create an Alliance " + ex);
     }
 }
        public override void Encode()
        {
            var data = new List <byte>();

            data.AddInt32(1);

            data.AddInt64(m_vHomeAlliance.GetAllianceId());        // 1 Alliance ID
            data.AddString(m_vHomeAlliance.GetAllianceName());     // 1 Alliance Name
            data.AddInt32(m_vHomeAlliance.GetAllianceBadgeData()); // 1 Alliance Badge
            data.AddInt32(m_vHomeAlliance.GetAllianceLevel());     // 1 Alliance Level

            data.AddInt64(9999);                                   // 2 Alliance ID
            data.AddString("Goblinland");                          // 2 Alliance Name
            data.AddInt32(0);                                      // 2 Alliance Badge
            data.AddInt32(1);                                      // 2 Alliance Level

            data.AddInt32(9999);                                   // 1 Stars
            data.AddInt32(0);                                      // 2 Stars

            data.AddInt32(0);                                      // 1 Village Destroyed
            data.AddInt32(100);                                    // 2 Village Destroyed

            data.AddInt32(0);                                      // 1 Unknown
            data.AddInt32(0);                                      // 2 Unknown

            data.AddInt32(100);                                    // Attack Used
            data.AddInt32(4000);                                   // XP Earned

            data.AddInt64(515631654);                              // War ID
            data.AddInt64(40);                                     // Members Count

            data.AddInt32(1);                                      // War Won Count

            data.Add((byte)99);
            data.AddInt32((int)TimeSpan.FromDays(1).TotalSeconds);
            data.AddInt64((int)(TimeSpan.FromDays(1).TotalSeconds - TimeSpan.FromDays(0.5).TotalSeconds));

            Encrypt(data.ToArray());
        }
예제 #22
0
 /// <summary>
 ///     This function create a new alliance in the database, with default parameters.
 /// </summary>
 /// <param name="a">The alliance data.</param>
 public void CreateAlliance(Alliance a)
 {
     try
     {
         using (ucsdbEntities db = new ucsdbEntities(m_vConnectionString))
         {
             db.clan.Add(
                 new clan
             {
                 ClanId         = a.GetAllianceId(),
                 LastUpdateTime = DateTime.Now,
                 Data           = a.SaveToJSON()
             }
                 );
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         _Logger.Print("     An exception occured during CreateAlliance processing :", Types.ERROR);
     }
 }
예제 #23
0
 /// <summary>
 ///     This function create a new alliance in the database, with default parameters.
 /// </summary>
 /// <param name="a">The alliance data.</param>
 public void CreateAlliance(Alliance a)
 {
     try
     {
         using (var db = new ucsdbEntities(m_vConnectionString))
         {
             db.clan.Add(
                 new clan
             {
                 ClanId         = a.GetAllianceId(),
                 LastUpdateTime = DateTime.Now,
                 Data           = a.SaveToJSON()
             }
                 );
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debugger.WriteLine("[UCS][UCSDB] An exception occured during CreateAlliance processing :", ex);
     }
 }
        public override async void Process(Level level)
        {
            try
            {
                Alliance alliance = await ObjectManager.GetAlliance(m_vAllianceId);

                if (alliance != null)
                {
                    if (!alliance.IsAllianceFull())
                    {
                        level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId());
                        AllianceMemberEntry member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId());
                        member.SetRole(1);
                        alliance.AddAllianceMember(member);

                        JoinedAllianceCommand b = new JoinedAllianceCommand();
                        b.SetAlliance(alliance);

                        AllianceRoleUpdateCommand c = new AllianceRoleUpdateCommand();
                        c.SetAlliance(alliance);
                        c.SetRole(1);
                        c.Tick(level);

                        AvailableServerCommandMessage a = new AvailableServerCommandMessage(Client);
                        a.SetCommandId(1);
                        a.SetCommand(b);

                        AvailableServerCommandMessage d = new AvailableServerCommandMessage(Client);
                        d.SetCommandId(8);
                        d.SetCommand(c);

                        PacketProcessor.Send(a);
                        PacketProcessor.Send(d);

                        PacketProcessor.Send(new AllianceStreamMessage(Client, alliance));
                    }
                }
            } catch (Exception) { }
        }
        public void CreateAlliance(Alliance alliance)
        {
            try
            {
                using (var ctx = new ucsdbEntities(m_vConnectionString))
                {
                    var newClan = new clan
                    {
                        ClanId         = alliance.GetAllianceId(),
                        LastUpdateTime = DateTime.Now,
                        Data           = alliance.SaveToJson()
                    };

                    ctx.clan.Add(newClan);
                    ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.Log(ex, "Exception while trying to create a new alliance in database.");
            }
        }
예제 #26
0
 public void CreateAlliance(Alliance a)
 {
     try
     {
         Debugger.WriteLine("Saving new Alliance to database (alliance id: " + a.GetAllianceId() + ")", null, 0);
         using (var db = new ucsdbEntities(m_vConnectionString))
         {
             db.clan.Add(
                 new clan
             {
                 ClanId         = a.GetAllianceId(),
                 LastUpdateTime = DateTime.Now,
                 Data           = a.SaveToJSON()
             }
                 );
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debugger.WriteLine("An exception occured during CreateAlliance processing:", ex, 0, ConsoleColor.DarkRed);
     }
 }
예제 #27
0
        public override void Process(Level level)
        {
            if (m_vAllianceName == null)
            {
                m_vAllianceName = "Clan";
            }

            if (m_vAllianceName.Length < 16 || m_vAllianceName.Length < 1)
            {
                if (m_vAllianceDescription.Length < 259 || m_vAllianceDescription.Length < 0)
                {
                    if (m_vAllianceBadgeData < 1 || (long)m_vAllianceBadgeData < 10000000000L)
                    {
                        if (m_vAllianceType < 0 || m_vAllianceType < 10)
                        {
                            if (m_vRequiredScore < 0 || m_vRequiredScore < 4201)
                            {
                                if (m_vWarFrequency < 0 || m_vWarFrequency < 10)
                                {
                                    if (m_vAllianceOrigin < 0 || m_vAllianceOrigin < 42000000)
                                    {
                                        if ((int)m_vWarAndFriendlyStatus < 0 || (int)m_vWarAndFriendlyStatus < 5)
                                        {
                                            Alliance alliance = ObjectManager.CreateAlliance();
                                            alliance.SetAllianceName(m_vAllianceName);
                                            alliance.SetAllianceDescription(m_vAllianceDescription);
                                            alliance.SetAllianceType(m_vAllianceType);
                                            alliance.SetRequiredScore(m_vRequiredScore);
                                            alliance.SetAllianceBadgeData(m_vAllianceBadgeData);
                                            alliance.SetAllianceOrigin(m_vAllianceOrigin);
                                            alliance.SetWarFrequency(m_vWarFrequency);
                                            alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus);
                                            level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId());
                                            AllianceMemberEntry entry = new AllianceMemberEntry(level.GetPlayerAvatar().GetId());
                                            entry.SetRole(2);
                                            alliance.AddAllianceMember(entry);
                                            JoinedAllianceCommand Command1 = new JoinedAllianceCommand();
                                            Command1.SetAlliance(alliance);
                                            AllianceRoleUpdateCommand Command2 = new AllianceRoleUpdateCommand();
                                            Command2.SetAlliance(alliance);
                                            Command2.SetRole(2);
                                            Command2.Tick(level);
                                            var a = new AvailableServerCommandMessage(Client);
                                            a.SetCommandId(1);
                                            a.SetCommand(Command1);
                                            var c = new AvailableServerCommandMessage(Client);
                                            c.SetCommandId(8);
                                            c.SetCommand(Command2);
                                            a.Send();
                                            c.Send();
                                        }
                                        else
                                        {
                                            ResourcesManager.DisconnectClient(Client);
                                        }
                                    }
                                    else
                                    {
                                        ResourcesManager.DisconnectClient(Client);
                                    }
                                }
                                else
                                {
                                    ResourcesManager.DisconnectClient(Client);
                                }
                            }
                            else
                            {
                                ResourcesManager.DisconnectClient(Client);
                            }
                        }
                        else
                        {
                            ResourcesManager.DisconnectClient(Client);
                        }
                    }
                    else
                    {
                        ResourcesManager.DisconnectClient(Client);
                    }
                }
                else
                {
                    ResourcesManager.DisconnectClient(Client);
                }
            }
            else
            {
                ResourcesManager.DisconnectClient(Client);
            }
        }
        public override async void Process(Level level)
        {
            try
            {
                ClientAvatar avatar = level.GetPlayerAvatar();
                Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId());

                if (await avatar.GetAllianceRole() == 2 && alliance.GetAllianceMembers().Count > 1)
                {
                    List<AllianceMemberEntry> members = alliance.GetAllianceMembers();
                    foreach (AllianceMemberEntry player in members.Where(player => player.GetRole() >= 3))
                    {
                        player.SetRole(2);

                        if (ResourcesManager.IsPlayerOnline(await ResourcesManager.GetPlayer(player.GetAvatarId())))
                        {
                            AllianceRoleUpdateCommand c = new AllianceRoleUpdateCommand();
                            c.SetAlliance(alliance);
                            c.SetRole(2);
                            c.Tick(level);

                            Level l = await ResourcesManager.GetPlayer(player.GetAvatarId());
                            AvailableServerCommandMessage d = new AvailableServerCommandMessage(l.GetClient());
                            d.SetCommandId(8);
                            d.SetCommand(c);
                            PacketProcessor.Send(d);
                        }
                        done = true;
                        break;
                    }
                    if (!done)
                    {
                        int count = alliance.GetAllianceMembers().Count;
                        Random rnd = new Random();
                        int id = rnd.Next(1, count);
                        while (id != level.GetPlayerAvatar().GetId())
                            id = rnd.Next(1, count);
                        int loop = 0;
                        foreach (AllianceMemberEntry player in members)
                        {
                            loop++;
                            if (loop == id)
                            {
                                player.SetRole(2);
                                if (ResourcesManager.IsPlayerOnline(await ResourcesManager.GetPlayer(player.GetAvatarId())))
                                {
                                    AllianceRoleUpdateCommand e = new AllianceRoleUpdateCommand();
                                    e.SetAlliance(alliance);
                                    e.SetRole(2);
                                    e.Tick(level);

                                    Level l2 = await ResourcesManager.GetPlayer(player.GetAvatarId());
                                    AvailableServerCommandMessage f = new AvailableServerCommandMessage(l2.GetClient());
                                    f.SetCommandId(8);
                                    f.SetCommand(e);
                                    PacketProcessor.Send(f);
                                }
                                break;
                            }
                        }
                    }
                }
                LeavedAllianceCommand a = new LeavedAllianceCommand();
                a.SetAlliance(alliance);
                a.SetReason(1);

                AvailableServerCommandMessage b = new AvailableServerCommandMessage(Client);
                b.SetCommandId(2);
                b.SetCommand(a);
                PacketProcessor.Send(b);

                alliance.RemoveMember(avatar.GetId());
                avatar.SetAllianceId(0);

                if (alliance.GetAllianceMembers().Count > 0)
                {
                    AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry();
                    eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    eventStreamEntry.SetSender(avatar);
                    eventStreamEntry.SetEventType(4);
                    eventStreamEntry.SetAvatarId(avatar.GetId());
                    eventStreamEntry.SetAvatarName(avatar.GetAvatarName());
                    alliance.AddChatMessage(eventStreamEntry);
                    foreach (Level onlinePlayer in ResourcesManager.GetOnlinePlayers())
                        if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == alliance.GetAllianceId())
                        {
                            AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(onlinePlayer.GetClient());
                            p.SetStreamEntry(eventStreamEntry);
                            PacketProcessor.Send(p);
                        }
                }
                else
                {
                    DatabaseManager.Single().RemoveAlliance(alliance);
                }
                PacketProcessor.Send(new LeaveAllianceOkMessage(Client, alliance));
            } catch (Exception) { }
        }
예제 #29
0
        public override async void Process(Level level)
        {
            try
            {
                Alliance a = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId());

                StreamEntry message   = a.GetChatMessages().Find(c => c.GetId() == MessageID);
                Level       requester = await ResourcesManager.GetPlayer(message.GetSenderId());

                if (Choice == 1)
                {
                    if (!a.IsAllianceFull())
                    {
                        requester.GetPlayerAvatar().SetAllianceId(a.GetAllianceId());

                        AllianceMemberEntry member = new AllianceMemberEntry(requester.GetPlayerAvatar().GetId());
                        member.SetRole(1);
                        a.AddAllianceMember(member);

                        StreamEntry e = a.GetChatMessages().Find(c => c.GetId() == MessageID);
                        e.SetJudgeName(level.GetPlayerAvatar().GetAvatarName());
                        e.SetState(2);

                        AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry();
                        eventStreamEntry.SetId(a.GetChatMessages().Count + 1);
                        eventStreamEntry.SetSender(requester.GetPlayerAvatar());
                        eventStreamEntry.SetAvatarName(level.GetPlayerAvatar().GetAvatarName());
                        eventStreamEntry.SetAvatarId(level.GetPlayerAvatar().GetId());
                        eventStreamEntry.SetEventType(2);

                        a.AddChatMessage(eventStreamEntry);

                        foreach (AllianceMemberEntry op in a.GetAllianceMembers())
                        {
                            Level player = await ResourcesManager.GetPlayer(op.GetAvatarId());

                            if (player.GetClient() != null)
                            {
                                AllianceStreamEntryMessage c = new AllianceStreamEntryMessage(player.GetClient());
                                AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(player.GetClient());
                                p.SetStreamEntry(eventStreamEntry);
                                c.SetStreamEntry(e);

                                PacketProcessor.Send(p);
                                PacketProcessor.Send(c);
                            }
                        }
                        if (ResourcesManager.IsPlayerOnline(requester))
                        {
                            JoinedAllianceCommand joinAllianceCommand = new JoinedAllianceCommand();
                            joinAllianceCommand.SetAlliance(a);

                            AvailableServerCommandMessage availableServerCommandMessage = new AvailableServerCommandMessage(requester.GetClient());
                            availableServerCommandMessage.SetCommandId(1);
                            availableServerCommandMessage.SetCommand(joinAllianceCommand);

                            AllianceRoleUpdateCommand d = new AllianceRoleUpdateCommand();
                            d.SetAlliance(a);
                            d.SetRole(4);
                            d.Tick(level);

                            AvailableServerCommandMessage c = new AvailableServerCommandMessage(Client);
                            c.SetCommandId(8);
                            c.SetCommand(d);

                            PacketProcessor.Send(new AnswerJoinRequestAllianceMessage(Client));
                            PacketProcessor.Send(availableServerCommandMessage);
                            PacketProcessor.Send(c);
                            PacketProcessor.Send(new AllianceStreamMessage(requester.GetClient(), a));
                        }
                    }
                }
                else
                {
                    StreamEntry e = a.GetChatMessages().Find(c => c.GetId() == MessageID);
                    e.SetJudgeName(level.GetPlayerAvatar().GetAvatarName());
                    e.SetState(3);

                    foreach (AllianceMemberEntry op in a.GetAllianceMembers())
                    {
                        Level player = await ResourcesManager.GetPlayer(op.GetAvatarId());

                        if (player.GetClient() != null)
                        {
                            AllianceStreamEntryMessage c = new AllianceStreamEntryMessage(player.GetClient());
                            c.SetStreamEntry(e);
                            PacketProcessor.Send(c);
                        }
                    }
                }
            } catch (Exception) { }
        }
 public static void AddAllianceInMemory(Alliance all)
 {
     m_vInMemoryAlliances.TryAdd(all.GetAllianceId(), all);
 }