Ejemplo n.º 1
0
        public ConquestInfo(MySqlDataReader readerconquestinfo)
        {
            Index       = Convert.ToInt32(readerconquestinfo["IndexID"]);
            Location    = new Point(Convert.ToInt32(readerconquestinfo["Location_X"]), Convert.ToInt32(readerconquestinfo["Location_Y"]));
            Size        = Convert.ToUInt16(readerconquestinfo["Size"]);
            Name        = Convert.ToString(readerconquestinfo["Name"]);
            MapIndex    = Convert.ToInt32(readerconquestinfo["MapIndex"]);
            PalaceIndex = Convert.ToInt32(readerconquestinfo["PalaceIndex"]);
            GuardIndex  = Convert.ToInt32(readerconquestinfo["GuardIndex"]);
            GateIndex   = Convert.ToInt32(readerconquestinfo["GateIndex"]);
            WallIndex   = Convert.ToInt32(readerconquestinfo["WallIndex"]);
            SiegeIndex  = Convert.ToInt32(readerconquestinfo["SiegeIndex"]);

            StartHour = Convert.ToByte(readerconquestinfo["StartHour"]);
            WarLength = Convert.ToInt32(readerconquestinfo["WarLength"]);
            Type      = (ConquestType)Convert.ToByte(readerconquestinfo["Type"]);
            Game      = (ConquestGame)Convert.ToByte(readerconquestinfo["Game"]);

            Monday    = Convert.ToBoolean(readerconquestinfo["Monday"]);
            Tuesday   = Convert.ToBoolean(readerconquestinfo["Tuesday"]);
            Wednesday = Convert.ToBoolean(readerconquestinfo["Wednesday"]);
            Thursday  = Convert.ToBoolean(readerconquestinfo["Thursday"]);
            Friday    = Convert.ToBoolean(readerconquestinfo["Friday"]);
            Saturday  = Convert.ToBoolean(readerconquestinfo["Saturday"]);
            Sunday    = Convert.ToBoolean(readerconquestinfo["Sunday"]);

            KingLocation      = new Point(Convert.ToInt32(readerconquestinfo["KingLocation_X"]), Convert.ToInt32(readerconquestinfo["KingLocation_Y"]));
            KingSize          = Convert.ToUInt16(readerconquestinfo["KingSize"]);
            FullMap           = Convert.ToBoolean(readerconquestinfo["FullMap"]);
            FlagIndex         = Convert.ToInt32(readerconquestinfo["FlagIndex"]);
            ControlPointIndex = Convert.ToInt32(readerconquestinfo["ControlPointIndex"]);
        }
Ejemplo n.º 2
0
        public void EndWar(ConquestGame type)
        {
            WarIsOn = false;

            switch (type)
            {
            case ConquestGame.ControlPoints:
                Dictionary <GuildObject, int> controlledPoints = new Dictionary <GuildObject, int>();
                int count = 0;

                foreach (KeyValuePair <ConquestGuildFlagInfo, Dictionary <GuildObject, int> > item in ControlPoints)
                {
                    controlledPoints.TryGetValue(item.Key.Guild, out count);

                    if (count == 0)
                    {
                        controlledPoints[item.Key.Guild] = 1;
                    }
                    else
                    {
                        controlledPoints[item.Key.Guild] += 1;
                    }
                }

                GuildObject tempWinning = Guild;
                int         tempInt;

                List <GuildObject> guilds = controlledPoints.Keys.ToList();

                //Check Scores
                for (int i = 0; i < guilds.Count; i++)
                {
                    controlledPoints.TryGetValue(guilds[i], out count);

                    if (tempWinning != null)
                    {
                        controlledPoints.TryGetValue(tempWinning, out tempInt);
                    }
                    else
                    {
                        tempInt = 0;
                    }

                    if (count > tempInt)
                    {
                        tempWinning = Envir.Guilds[i];
                    }
                }

                TakeConquest(null, tempWinning);

                break;
            }
        }
Ejemplo n.º 3
0
        public ConquestInfo(BinaryReader reader)
        {
            Index       = reader.ReadInt32();
            Location    = new Point(reader.ReadInt32(), reader.ReadInt32());
            Size        = reader.ReadUInt16();
            Name        = reader.ReadString();
            MapIndex    = reader.ReadInt32();
            PalaceIndex = reader.ReadInt32();
            GuardIndex  = reader.ReadInt32();
            GateIndex   = reader.ReadInt32();
            WallIndex   = reader.ReadInt32();
            SiegeIndex  = reader.ReadInt32();
            counter     = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestGuards.Add(new ConquestArcherInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ExtraMaps.Add(reader.ReadInt32());
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestGates.Add(new ConquestGateInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestWalls.Add(new ConquestWallInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestSieges.Add(new ConquestSiegeInfo(reader));
            }
            StartHour = reader.ReadByte();
            WarLength = reader.ReadInt32();
            Type      = (ConquestType)reader.ReadByte();
            Game      = (ConquestGame)reader.ReadByte();

            Monday    = reader.ReadBoolean();
            Tuesday   = reader.ReadBoolean();
            Wednesday = reader.ReadBoolean();
            Thursday  = reader.ReadBoolean();
            Friday    = reader.ReadBoolean();
            Saturday  = reader.ReadBoolean();
            Sunday    = reader.ReadBoolean();

            ObjectLoc  = new Point(reader.ReadInt32(), reader.ReadInt32());
            ObjectSize = reader.ReadUInt16();
        }
Ejemplo n.º 4
0
        public void AutoSchedule()
        {
            int start  = ((Info.StartHour * 60));
            int finish = ((Info.StartHour * 60) + Info.WarLength);
            int now    = ((Envir.Now.Hour * 60) + Envir.Now.Minute);

            if (WarIsOn && StartType == ConquestType.Forced && WarEndTime <= Envir.Now)
            {
                EndWar(Info.Game);
            }

            if (StartType != ConquestType.Forced)
            {
                if (WarIsOn && (now > start && finish <= now))
                {
                    EndWar(Info.Game);
                }
                else if (start <= now && finish > now && CheckDay())
                {
                    if (!WarIsOn)
                    {
                        if (Info.Type == ConquestType.Request)
                        {
                            if (GuildInfo.AttackerID != -1)
                            {
                                GameType  = Info.Game;
                                StartType = Info.Type;
                                StartWar(Info.Game);
                            }
                        }
                        else
                        {
                            GameType  = Info.Game;
                            StartType = Info.Type;
                            StartWar(Info.Game);
                        }
                    }
                }
            }

            ScheduleTimer = Envir.Time + Settings.Minute;
        }
Ejemplo n.º 5
0
        public void AutoSchedule()
        {
            int start  = ((Info.StartHour * 60));
            int finish = ((Info.StartHour * 60) + Info.WarLength);
            int now    = ((DateTime.Now.Hour * 60) + DateTime.Now.Minute);

            if (WarIsOn && StartType == ConquestType.Forced && WarEndTime <= DateTime.Now)
            {
                WarIsOn = false;
            }

            if (StartType != ConquestType.Forced)
            {
                if (WarIsOn && start > now || finish <= now)
                {
                    WarIsOn = false;
                }
                else if (start <= now && finish > now && CheckDay())
                {
                    if (!WarIsOn)
                    {
                        if (Info.Type == ConquestType.Request)
                        {
                            if (AttackerID != -1)
                            {
                                GameType  = Info.Game;
                                StartType = Info.Type;
                                WarIsOn   = true;
                            }
                        }
                        else
                        {
                            GameType  = Info.Game;
                            StartType = Info.Type;
                            WarIsOn   = true;
                        }
                    }
                }
            }
            ScheduleTimer = Envir.Time + Settings.Minute;
        }
Ejemplo n.º 6
0
        public ConquestInfo(BinaryReader reader, Manager manager)
        {
            Manager Envir = manager;

            Index = reader.ReadInt32();

            if (Envir.LoadVersion > 73)
            {
                FullMap = reader.ReadBoolean();
            }

            Location    = new Point(reader.ReadInt32(), reader.ReadInt32());
            Size        = reader.ReadUInt16();
            Name        = reader.ReadString();
            MapIndex    = reader.ReadInt32();
            PalaceIndex = reader.ReadInt32();
            GuardIndex  = reader.ReadInt32();
            GateIndex   = reader.ReadInt32();
            WallIndex   = reader.ReadInt32();
            SiegeIndex  = reader.ReadInt32();

            if (Envir.LoadVersion > 72)
            {
                FlagIndex = reader.ReadInt32();
            }

            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestGuards.Add(new ConquestArcherInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ExtraMaps.Add(reader.ReadInt32());
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestGates.Add(new ConquestGateInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestWalls.Add(new ConquestWallInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestSieges.Add(new ConquestSiegeInfo(reader));
            }

            if (Envir.LoadVersion > 72)
            {
                counter = reader.ReadInt32();
                for (int i = 0; i < counter; i++)
                {
                    ConquestFlags.Add(new ConquestFlagInfo(reader));
                }
            }

            StartHour = reader.ReadByte();
            WarLength = reader.ReadInt32();
            Type      = (ConquestType)reader.ReadByte();
            Game      = (ConquestGame)reader.ReadByte();

            Monday    = reader.ReadBoolean();
            Tuesday   = reader.ReadBoolean();
            Wednesday = reader.ReadBoolean();
            Thursday  = reader.ReadBoolean();
            Friday    = reader.ReadBoolean();
            Saturday  = reader.ReadBoolean();
            Sunday    = reader.ReadBoolean();

            KingLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            KingSize     = reader.ReadUInt16();

            if (Envir.LoadVersion > 74)
            {
                ControlPointIndex = reader.ReadInt32();
                counter           = reader.ReadInt32();
                for (int i = 0; i < counter; i++)
                {
                    ControlPoints.Add(new ConquestFlagInfo(reader));
                }
            }
        }
Ejemplo n.º 7
0
        private void AtWarChanged()
        {
            if (WarIsOn)
            {
                if (StartType == ConquestType.Forced)
                {
                    WarStartTime = DateTime.Now;
                    WarEndTime = WarStartTime.AddMinutes(Info.WarLength);
                    GameType = Info.Game;
                }

                NPCVisibility(true);

                switch (GameType)
                {
                    case ConquestGame.CapturePalace:
                        break;
                    case ConquestGame.KingOfHill:
                        CreateZone(true);
                        break;
                    case ConquestGame.Random:
                        break;
                    case ConquestGame.Classic:
                        break;
                }

            }
            else
            {
                NPCVisibility(false);

                for (int i = 0; i < ArcherList.Count; i++)
                {
                    if (ArcherList[i].ArcherMonster != null)
                        ArcherList[i].ArcherMonster.Target = null;
                }

                switch (StartType)
                {
                    case ConquestType.Request:
                        AttackerID = -1;
                        break;

                }

                switch (GameType)
                {
                    case ConquestGame.CapturePalace:
                        break;
                    case ConquestGame.KingOfHill:
                        CreateZone(false);
                        break;
                    case ConquestGame.Random:
                        break;
                    case ConquestGame.Classic:
                        break;
                }
            }
        }
Ejemplo n.º 8
0
        public void AutoSchedule()
        {
            int start = ((Info.StartHour * 60));
            int finish = ((Info.StartHour * 60) + Info.WarLength);
            int now = ((DateTime.Now.Hour * 60) + DateTime.Now.Minute);

            if (WarIsOn && StartType == ConquestType.Forced && WarEndTime <= DateTime.Now)
            {
                WarIsOn = false;
            }

            if (StartType != ConquestType.Forced)
            {
            if (WarIsOn && start > now || finish <= now)
            {
                WarIsOn = false;
            }
            else if (start <= now && finish > now && CheckDay())
            {
                if (!WarIsOn)
                {
                    if (Info.Type == ConquestType.Request)
                    {
                        if (AttackerID != -1)
                        {
                            GameType = Info.Game;
                            StartType = Info.Type;
                            WarIsOn = true;
                        }
                    }
                    else
                    {
                        GameType = Info.Game;
                        StartType = Info.Type;
                        WarIsOn = true;
                    }

                }
            }
            }
            ScheduleTimer = Envir.Time + Settings.Minute;
        }
Ejemplo n.º 9
0
 public void StartWar(ConquestGame type)
 {
     WarIsOn = true;
 }
Ejemplo n.º 10
0
        private void AtWarChanged()
        {
            if (WarIsOn)
            {
                if (StartType == ConquestType.Forced)
                {
                    WarStartTime = DateTime.Now;
                    WarEndTime   = WarStartTime.AddMinutes(Info.WarLength);
                    GameType     = Info.Game;
                }

                NPCVisibility(true);

                switch (GameType)
                {
                case ConquestGame.CapturePalace:
                    break;

                case ConquestGame.KingOfHill:
                    CreateZone(true);
                    break;

                case ConquestGame.Random:
                    break;

                case ConquestGame.Classic:
                    break;
                }
            }
            else
            {
                NPCVisibility(false);

                for (int i = 0; i < ArcherList.Count; i++)
                {
                    if (ArcherList[i].ArcherMonster != null)
                    {
                        ArcherList[i].ArcherMonster.Target = null;
                    }
                }

                switch (StartType)
                {
                case ConquestType.Request:
                    AttackerID = -1;
                    break;
                }

                switch (GameType)
                {
                case ConquestGame.CapturePalace:
                    break;

                case ConquestGame.KingOfHill:
                    CreateZone(false);
                    break;

                case ConquestGame.Random:
                    break;

                case ConquestGame.Classic:
                    break;
                }
            }
        }
Ejemplo n.º 11
0
        public void AutoSchedule()
        {
            int start  = ((Info.StartHour * 60));
            int finish = ((Info.StartHour * 60) + Info.WarLength);
            int now    = ((DateTime.Now.Hour * 60) + DateTime.Now.Minute);

            if (CheckDay())
            {
                //          Pete        Auto Announce.      12/09/2016
                if (AttackerID != -1)
                {
                    if (now == 1080 && !hasAnnounce)        //  18:00
                    {
                        Envir.Broadcast(new S.Chat {
                            Message = string.Format("{0} war will start in 1 hour!", Info.Name), Type = ChatType.System
                        });
                        hasAnnounce = true;
                    }
                    if (now == 1081)
                    {
                        hasAnnounce = false;
                    }

                    if (now == 1110 && !hasAnnounce)        //  18:30
                    {
                        Envir.Broadcast(new S.Chat {
                            Message = string.Format("{0} war will start in 30 minutes!", Info.Name), Type = ChatType.System
                        });
                        hasAnnounce = true;
                    }
                    if (now == 1111)
                    {
                        hasAnnounce = false;
                    }

                    if (now == 1130 && !hasAnnounce)        //  18:50
                    {
                        Envir.Broadcast(new S.Chat {
                            Message = string.Format("{0} war will start in 10 minutes!", Info.Name), Type = ChatType.System
                        });
                        hasAnnounce = true;
                    }
                    if (now == 1131)
                    {
                        hasAnnounce = false;
                    }

                    if (now == 1160 && !hasAnnounce)        //  19:20
                    {
                        Envir.Broadcast(new S.Chat {
                            Message = string.Format("{0} war will end in 10 minutes!", Info.Name), Type = ChatType.System
                        });
                        hasAnnounce = true;
                    }
                    if (now == 1161)
                    {
                        hasAnnounce = false;
                    }
                }
            }

            if (WarIsOn && StartType == ConquestType.Forced && WarEndTime <= DateTime.Now)
            {
                EndWar(Info.Game);
            }

            if (StartType != ConquestType.Forced)
            {
                if (WarIsOn && now == 1170)
                {
                    EndWar(Info.Game);
                    if (Guild != null && Guild.Name != null &&
                        Guild.Name != "")
                    {
                        if (!hasAnnounce)                        //  21:00
                        {
                            Envir.Broadcast(new S.Chat {
                                Message = string.Format("{0} war has ended! The winning guild {1} now occupy {0}!", Info.Name, Guild.Name), Type = ChatType.System
                            });
                            hasAnnounce = true;
                        }
                    }
                }
                else if (start <= now && finish > now && CheckDay())
                {
                    if (!WarIsOn)
                    {
                        if (Info.Type == ConquestType.Request)
                        {
                            if (AttackerID != -1)
                            {
                                GameType  = Info.Game;
                                StartType = Info.Type;
                                StartWar(Info.Game);
                            }
                        }
                        else
                        {
                            GameType  = Info.Game;
                            StartType = Info.Type;
                            StartWar(Info.Game);
                        }
                    }
                }
            }
            ScheduleTimer = Envir.Time + Settings.Minute;
        }
Ejemplo n.º 12
0
        public ConquestInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Location = new Point(reader.ReadInt32(), reader.ReadInt32());
            Size = reader.ReadUInt16();
            Name = reader.ReadString();
            MapIndex = reader.ReadInt32();
            PalaceIndex = reader.ReadInt32();
            GuardIndex = reader.ReadInt32();
            GateIndex = reader.ReadInt32();
            WallIndex = reader.ReadInt32();
            SiegeIndex = reader.ReadInt32();
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestGuards.Add(new ConquestArcherInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ExtraMaps.Add(reader.ReadInt32());
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestGates.Add(new ConquestGateInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestWalls.Add(new ConquestWallInfo(reader));
            }
            counter = reader.ReadInt32();
            for (int i = 0; i < counter; i++)
            {
                ConquestSieges.Add(new ConquestSiegeInfo(reader));
            }
            StartHour = reader.ReadByte();
            WarLength = reader.ReadInt32();
            Type = (ConquestType)reader.ReadByte();
            Game = (ConquestGame)reader.ReadByte();

            Monday = reader.ReadBoolean();
            Tuesday = reader.ReadBoolean();
            Wednesday = reader.ReadBoolean();
            Thursday = reader.ReadBoolean();
            Friday = reader.ReadBoolean();
            Saturday = reader.ReadBoolean();
            Sunday = reader.ReadBoolean();

            ObjectLoc = new Point(reader.ReadInt32(), reader.ReadInt32());
            ObjectSize = reader.ReadUInt16();

        }