Exemplo n.º 1
0
        private static void MapUpdate(object nullValue)
        {
            Dictionary <ushort, IList <MinotaurRelic> > relics = new Dictionary <ushort, IList <MinotaurRelic> >();

            foreach (MinotaurRelic relic in MinotaurRelicManager.GetAllRelics())
            {
                if (!relics.ContainsKey(relic.CurrentRegionID))
                {
                    relics.Add(relic.CurrentRegionID, new List <MinotaurRelic>());
                }
                relics[relic.CurrentRegionID].Add(relic);
            }
            foreach (GameClient clt in WorldMgr.GetAllPlayingClients())
            {
                if (clt == null || clt.Player == null)
                {
                    continue;
                }

                if (relics.ContainsKey(clt.Player.CurrentRegionID))
                {
                    foreach (MinotaurRelic relic in relics[clt.Player.CurrentRegionID])
                    {
                        clt.Player.Out.SendMinotaurRelicMapUpdate((byte)relic.RelicID, relic.CurrentRegionID, (int)relic.Position.X, (int)relic.Position.Y, (int)relic.Position.Z);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void setPvPZone(string set)
        {
            GameNPC last = null;

            GameNPC[] search = WorldMgr.GetNPCsByName(m_PvPZone, eRealm.None);
            foreach (GameNPC searching in search)
            {
                if (searching.GuildName == "PvP Setup")
                {
                    last = searching;
                }
            }
            if (last != null)
            {
                lastRegionID = last.CurrentRegionID;
            }
            m_PvPZone = set;
            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                bool ok = lastRegionID == 69 ? false : true;
                if (client.Player.CurrentRegionID == lastRegionID && ok)
                {
                    PortToPvPZone(client.Player);
                }
                client.Player.Out.SendMessage("The PvP Zone has changed to " + m_PvPZone + "!", eChatType.CT_Important, eChatLoc.CL_ChatWindow);
            }
        }
        public static int SpawnChests(RegionTimer timer)
        {
            Console.WriteLine("Treasure Chests created");
            IList <ItemTemplate> items = GameServer.Database.SelectObjects <ItemTemplate>("PackageID = '" + GameServer.Database.Escape("DragonWeapons") + "' OR PackageID = '" + GameServer.Database.Escape("LabWeaps") + "' OR PackageID = '" + GameServer.Database.Escape("Artifacts") + "'");

            for (int i = 0; i < numberOfChests; i++)
            {
                TreasureChest chest = new TreasureChest(items);
                //15k
                chest.X               = Util.Random(startX - radius, startX + radius);
                chest.Y               = Util.Random(startY - radius, startY + radius);
                chest.Z               = 10000;
                chest.Heading         = 13;
                chest.CurrentRegionID = currentregionID;
                chest.Model           = 1596;
                chest.AddToWorld();
            }
            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                client.Player.TempProperties.removeProperty("Treasure_Chest");
                client.Out.SendMessage(numberOfChests + " Treasure Chests created in this zone", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage(numberOfChests + " Treasure Chests created in this zone", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage(numberOfChests + " Treasure Chests created in this zone", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
            }
            Mob mob = GameServer.Database.SelectObject <Mob>("Name = '" + GameServer.Database.Escape("Redemption") + "'");

            if (mob != null)
            {
                GameNPC npc = new GameNPC();
                npc.LoadFromDatabase(mob);
                new RegionTimer(npc, new RegionTimerCallback(SpawnChests), (TreasureChestRecastDelay * 60 * 1000));
            }
            return(0);
        }
Exemplo n.º 4
0
        public void MountRelic(GameRelic relic, bool returning)
        {
            m_mountedRelic = relic;

            if (relic.CurrentCarrier != null && returning == false)
            {
                /* Sending broadcast */
                string message = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "GameRelicPad.MountRelic.Stored", relic.CurrentCarrier.Name, GlobalConstants.RealmToName((eRealm)relic.CurrentCarrier.Realm), relic.Name, Name);
                foreach (GameClient cl in WorldMgr.GetAllPlayingClients())
                {
                    if (cl.Player.ObjectState != eObjectState.Active)
                    {
                        continue;
                    }

                    cl.Out.SendMessage(LanguageMgr.GetTranslation(cl.Account.Language, "GameRelicPad.MountRelic.Captured", GlobalConstants.RealmToName((eRealm)relic.CurrentCarrier.Realm), relic.Name), eChatType.CT_ScreenCenterSmaller, eChatLoc.CL_SystemWindow);
                    cl.Out.SendMessage(message + "\n" + message + "\n" + message, eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }

                NewsMgr.CreateNews(message, relic.CurrentCarrier.Realm, eNewsType.RvRGlobal, false);

                /* Increasing of CapturedRelics */

                // select targets to increase CapturedRelics
                // TODO increase stats
                List <GamePlayer> targets = new List <GamePlayer>();
                if (relic.CurrentCarrier.Group != null)
                {
                    foreach (GamePlayer p in relic.CurrentCarrier.Group.GetPlayersInTheGroup())
                    {
                        targets.Add(p);
                    }
                }
                else
                {
                    targets.Add(relic.CurrentCarrier);
                }

                foreach (GamePlayer target in targets)
                {
                    target.CapturedRelics++;
                }

                Notify(RelicPadEvent.RelicMounted, this, new RelicPadEventArgs(relic.CurrentCarrier, relic));
            }
            else
            {
                // relic returned to pad, probably because it was dropped on ground and timer expired.
                string message = string.Format("The {0} has been returned to {1}.", relic.Name, Name);
                foreach (GameClient cl in WorldMgr.GetAllPlayingClients())
                {
                    if (cl.Player.ObjectState != eObjectState.Active)
                    {
                        continue;
                    }

                    cl.Out.SendMessage(message + "\n" + message + "\n" + message, eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// This method defines and formats the various strings to be used
        /// </summary>
        private static void StartList()
        {
            int stormClients = 0;

            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                stormClients++;
            }

            // now update both entries

            string Updater = "";

            //Set up our URI to be passed to the WebClient.
            Updater = UrlEncode("http://portal.dolserver.net/serverlist.php?action=submit&username="******"&password="******"&totalclients=" + stormClients.ToString() + "&version=" + ScriptVersion);

            if (!ListUpdater(Updater))
            {
                if (log.IsInfoEnabled)
                {
                    log.Info("Your server's entry was not updated!");
                }
            }
            else
            {
                if (log.IsInfoEnabled)
                {
                    log.Info("Your server's entry was successfully updated!");
                }
            }
        }
Exemplo n.º 6
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (args.Length != 2)
            {
                DisplaySyntax(client);
                return;
            }

            if (args[1] == "1")
            {
                foreach (GameClient thisClient in WorldMgr.GetAllPlayingClients())
                {
                    if (thisClient.Player.Level == 50)
                    {
                        thisClient.Player.Out.SendMessage("RvR 하러 오세요. (Come to RvR)", eChatType.CT_Broadcast, eChatLoc.CL_SystemWindow);
                    }
                }
            }
            else if (args[1] == "2")
            {
                foreach (GameClient thisClient in WorldMgr.GetAllPlayingClients())
                {
                    if (thisClient.Player.Level == 50)
                    {
                        thisClient.Player.Out.SendMessage("RvR 이제 안해요. (We will quit RvR)", eChatType.CT_Broadcast, eChatLoc.CL_SystemWindow);
                    }
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Gets a combined list of Appeals for every player that is online.
        /// </summary>
        /// <returns></returns>
        public static IList <DBAppeal> GetAllAppeals()
        {
            var rlist      = new List <DBAppeal>();
            var clientlist = WorldMgr.GetAllPlayingClients();

            foreach (GameClient c in clientlist)
            {
                try
                {
                    DBAppeal ap = GetAppealByPlayerName(c.Player.Name);
                    if (ap != null)
                    {
                        rlist.Add(ap);
                    }
                }
                catch
                {
                    // most likely player is null due to disconnect
                }
            }

            TotalAppeals = rlist.Count;

            return(rlist);
        }
        private int CallBack(RegionTimer timer)
        {
            if (targetName == "")
            {
                Console.WriteLine("targetname == \"\"");
                return(0);
            }
            GamePlayer target = null;

            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                if (client.Player.Name == targetName)
                {
                    Console.WriteLine("Found player");
                    target = client.Player;
                }
            }
            if (m_pickup == null)
            {
                return(0);
            }
            if (target == null)
            {
                targetName = "";
                return(0);
            }
            if (this == null)
            {
                target.Out.SendCloseTimerWindow();
                return(0);
            }
            if (target.InCombat)
            {
                SendReply(target, "You can not steal my loot while in combat, argh! ");
                targetName = "";
                return(0);
            }
            if (!this.IsWithinRadius(target, WorldMgr.INTERACT_DISTANCE, true))
            {
                targetName = "";
                return(0);
            }
            target.Out.SendCloseTimerWindow();
            GiveRewards(target);
            targetName = "";

            m_pickup.Stop();

            this.Model = 1;
            this.Name  = "Used";
            this.RemoveFromWorld();

            return(0);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Event handler fired when players enters the game
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        private static void PlayerEntered(DOLEvent e, object sender, EventArgs arguments)
        {
            if (ServerProperties.Properties.SHOW_LOGINS == false)
            {
                return;
            }

            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

            if (player.IsAnonymous)
            {
                return;
            }

            foreach (GameClient pclient in WorldMgr.GetAllPlayingClients())
            {
                if (player.Client == pclient)
                {
                    continue;
                }

                string message = LanguageMgr.GetTranslation(pclient, "Scripts.Events.PlayerEnterExit.Entered", player.Name);

                if (player.Client.Account.PrivLevel > 1)
                {
                    message = LanguageMgr.GetTranslation(pclient, "Scripts.Events.PlayerEnterExit.Staff", message);
                }
                else
                {
                    string realm = string.Empty;
                    if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_Normal)
                    {
                        realm = "[" + GlobalConstants.RealmToName(player.Realm) + "] ";
                    }

                    message = realm + message;
                }

                eChatType chatType = eChatType.CT_System;

                if (Enum.IsDefined(typeof(eChatType), ServerProperties.Properties.SHOW_LOGINS_CHANNEL))
                {
                    chatType = (eChatType)ServerProperties.Properties.SHOW_LOGINS_CHANNEL;
                }

                pclient.Out.SendMessage(message, chatType, eChatLoc.CL_SystemWindow);
            }
        }
Exemplo n.º 10
0
        public static void AutomaticShutdown(object param)
        {
            if (m_firstAutoCheck)
            {
                // skip the first check.  This is for debugging, to make sure the timer continues to run after setting it to a small interval for testing
                m_firstAutoCheck = false;
                return;
            }

            // At least 1 hour
            if (Properties.HOURS_UPTIME_BETWEEN_SHUTDOWN <= 0)
            {
                return;
            }

            if (m_shuttingDown)
            {
                return;
            }

            TimeSpan uptime = TimeSpan.FromMilliseconds(GameServer.Instance.TickCount);

            if (uptime.TotalHours >= Properties.HOURS_UPTIME_BETWEEN_SHUTDOWN && DateTime.Now.Hour == AUTOMATEDSHUTDOWN_HOURTOSHUTDOWN)
            {
                m_counter = AUTOMATEDSHUTDOWN_SHUTDOWNWARNINGMINUTES * 60;

                //Set the timer for a 5 min callback
                m_currentCallbackTime = 5 * 60 * 1000;
                m_timer.Dispose();
                m_timer = new Timer(new TimerCallback(CountDown), null, m_currentCallbackTime, 1);

                DateTime date;
                date = DateTime.Now;
                date = date.AddSeconds(m_counter);

                foreach (GameClient m_client in WorldMgr.GetAllPlayingClients())
                {
                    m_client.Out.SendDialogBox(eDialogCode.SimpleWarning, 0, 0, 0, 0, eDialogType.Ok, true, "Automated server restart / backup triggered. Restart in " + m_counter / 60 + " mins! (Restart at " + date.ToString("HH:mm \"GMT\" zzz") + ")");
                    //m_client.Out.SendMessage("Automated server restart / backup triggered. Restart in " + m_counter / 60 + " mins! (Restart on " + date.ToString("HH:mm \"GMT\" zzz") + ")", eChatType.CT_System, eChatLoc.CL_PopupWindow);
                }

                string msg = "Automated server restart in " + m_counter / 60 + " mins! (Restart at " + date.ToString("HH:mm \"GMT\" zzz") + ")";
                log.Warn(msg);

                // You have an IRC Bot
                //if (ServerIRC.IRCBot != null) ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, msg);
            }
            else
            {
                log.Info("Uptime = " + uptime.TotalHours.ToString("N1") + ", restart uptime = " + Properties.HOURS_UPTIME_BETWEEN_SHUTDOWN.ToString() +
                         " | Current hour = " + DateTime.Now.Hour.ToString() + ", restart hour = " + AUTOMATEDSHUTDOWN_HOURTOSHUTDOWN.ToString());
            }
        }
Exemplo n.º 11
0
 private static void NotifyFriendsOfLoginIfNotAnonymous(GamePlayer player)
 {
     if (!player.IsAnonymous)
     {
         var friendList = new[] { player.Name };
         foreach (GameClient pclient in WorldMgr.GetAllPlayingClients())
         {
             if (pclient.Player.Friends.Contains(player.Name))
             {
                 pclient.Out.SendAddFriends(friendList);
             }
         }
     }
 }
Exemplo n.º 12
0
        protected virtual int Timer(RegionTimer callingTimer)
        {
            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                #region Kick Speed Hackers
                //Wont Kick Spectators or Gm/Admins
                if (client.Player.MaxSpeed > Speed && client.Player.Client.Account.PrivLevel == 1)
                {
                    foreach (GameClient player in WorldMgr.GetAllPlayingClients())
                    {
                        player.Out.SendMessage("Auto Kick\n" +
                                               client.Player.Name + " From IP (" + client.Account.LastLoginIP + ") Has Been Kicked For Trying To Speed Hack!", eChatType.CT_Staff, eChatLoc.CL_ChatWindow);
                    }
                    StringBuilder builder = new StringBuilder();
                    builder.Append("Class= (" + client.Player.CharacterClass.Name + ") Speed= (" + client.Player.MaxSpeed + ")" + " Name= (" + client.Player.Name + ")" + " Account= (" + client.Account.Name + ") IP= (" + client.Account.LastLoginIP + ")");
                    GameServer.Instance.LogCheatAction(builder.ToString());

                    client.Player.Out.SendMessage("Read The Rules Its Not Hard", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                    GameServer.Instance.Disconnect(client);
                    totaloffenses++;
                    return(INTERVAL);
                }

                if (client.Player.MaxSpeedBase > Speed && client.Player.Client.Account.PrivLevel == 1)
                {
                    foreach (GameClient player in WorldMgr.GetAllPlayingClients())
                    {
                        player.Out.SendMessage("Auto Kick\n" +
                                               client.Player.Name + " From IP (" + client.Account.LastLoginIP + ") Has Been Kicked For Trying To Speed Hack!", eChatType.CT_Staff, eChatLoc.CL_ChatWindow);
                    }
                    StringBuilder builder = new StringBuilder();
                    builder.Append("Class= (" + client.Player.CharacterClass.Name + ") Speed Base = (" + client.Player.MaxSpeedBase + ")" + " Name= (" + client.Player.Name + ")" + " Account= (" + client.Account.Name + ") IP= (" + client.Account.LastLoginIP + ")");
                    GameServer.Instance.LogCheatAction(builder.ToString());

                    client.Player.Out.SendMessage("Read The Rules Its Not Hard", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                    GameServer.Instance.Disconnect(client);
                    totaloffenses++;
                    return(INTERVAL);
                }
                #endregion



                client.Out.SendSpellCastAnimation(this, 4321, 30);
                RegionTimer timer = new RegionTimer(client.Player, new RegionTimerCallback(ShowEffect), 3000);
            }
            return(INTERVAL);
        }
Exemplo n.º 13
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (args.Length < 2)
            {
                client.Out.SendMessage("Use: /team <message>", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            string msg = string.Join(" ", args, 1, args.Length - 1);

            foreach (GameClient player in WorldMgr.GetAllPlayingClients())
            {
                if (player.Account.PrivLevel > 1)
                {
                    player.Out.SendMessage("[StaffInformation-" + client.Player.Name + "]:\n " + msg, eChatType.CT_Staff, eChatLoc.CL_ChatWindow);
                }
            }
        }
Exemplo n.º 14
0
        public override void Perform(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player  = BehaviourUtils.GuessGamePlayerFromNotify(e, sender, args);
            string     message = BehaviourUtils.GetPersonalizedMessage(P, player);

            switch (Q)
            {
            case eTextType.Dialog:
                player.Out.SendCustomDialog(message, null);
                break;

            case eTextType.Emote:
                player.Out.SendMessage(message, eChatType.CT_Emote, eChatLoc.CL_ChatWindow);
                break;

            case eTextType.Say:
                player.Out.SendMessage(message, eChatType.CT_Say, eChatLoc.CL_ChatWindow);
                break;

            case eTextType.SayTo:
                player.Out.SendMessage(message, eChatType.CT_System, eChatLoc.CL_PopupWindow);
                break;

            case eTextType.Yell:
                player.Out.SendMessage(message, eChatType.CT_Help, eChatLoc.CL_ChatWindow);
                break;

            case eTextType.Broadcast:
                foreach (GameClient clientz in WorldMgr.GetAllPlayingClients())
                {
                    clientz.Player.Out.SendMessage(message, eChatType.CT_Broadcast, eChatLoc.CL_ChatWindow);
                }

                break;

            case eTextType.Read:
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Behaviour.MessageAction.ReadMessage", message), eChatType.CT_Emote, eChatLoc.CL_PopupWindow);
                break;

            case eTextType.None:
                // nohting
                break;
            }
        }
Exemplo n.º 15
0
        public static void CancelVoting(GamePlayer aGM)
        {
            if (m_Timer != null)
            {
                m_Timer.Dispose();
            }
            m_Timer   = null;
            m_Current = null;
            string msg = aGM.Name + " cancels the voting!";

            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                client.Player.TempProperties.removeProperty(PLY_TEMP_PROP_KEY);
                client.Out.SendMessage(msg, eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage(msg, eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                client.Out.SendPlaySound(eSoundType.Craft, 0x02);
            }
            //NewsMgr.CreateNews(msg, (byte)eRealm.None, eNewsType.RvRGlobal, false);
        }
Exemplo n.º 16
0
        public void RemoveRelic(GameRelic relic)
        {
            m_mountedRelic = null;

            if (relic.CurrentCarrier != null)
            {
                string message = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "GameRelicPad.RemoveRelic.Removed", relic.CurrentCarrier.Name, GlobalConstants.RealmToName((eRealm)relic.CurrentCarrier.Realm), relic.Name, Name);
                foreach (GameClient cl in WorldMgr.GetAllPlayingClients())
                {
                    if (cl.Player.ObjectState != eObjectState.Active)
                    {
                        continue;
                    }
                    cl.Out.SendMessage(message + "\n" + message + "\n" + message, eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }
                NewsMgr.CreateNews(message, relic.CurrentCarrier.Realm, eNewsType.RvRGlobal, false);

                Notify(RelicPadEvent.RelicStolen, this, new RelicPadEventArgs(relic.CurrentCarrier, relic));
            }
        }
Exemplo n.º 17
0
        public static void BeginVoting(GamePlayer aGM, DBVoting aVoting)
        {
            m_Current = aVoting;
            m_Dura    = STD_VOTING_DURATION;
            string msg1 = "Voting in progress... type /vote";
            string msg2 = aGM.Name + " starts a new voting for " + m_Dura + "sec ... Use /vote";

            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                client.Player.TempProperties.removeProperty(PLY_TEMP_PROP_KEY);
                client.Out.SendMessage(msg1, eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage(msg2, eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                client.Out.SendPlaySound(eSoundType.Craft, 0x04);
            }
            //NewsMgr.CreateNews(aGM.Name+" starts a new voting!", (byte)eRealm.None, eNewsType.RvRGlobal, false);
            if (m_Timer != null)
            {
                m_Timer.Dispose();
            }
            m_Timer = new Timer(new TimerCallback(OnTimer), m_Timer, 1000, 1000);
        }
Exemplo n.º 18
0
        protected static void OnTimer(object state)
        {
            if (m_Dura <= 0)
            {
                EndVoting();
                return;
            }
            else
            {
                --m_Dura;
            }

            if (m_Dura == 60 || m_Dura == 30 || m_Dura == 10 || m_Dura == 5)
            {
                string msg = "Voting ends in " + m_Dura + "sec...";
                foreach (GameClient client in WorldMgr.GetAllPlayingClients())
                {
                    client.Out.SendMessage(msg, eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                    client.Out.SendMessage(msg, eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                }
            }
        }
Exemplo n.º 19
0
        public void OnCommand(GameClient client, string[] args)
        {
            var clients = WorldMgr.GetAllPlayingClients();
            var message = new List <string>();

            foreach (GameClient gc in clients)
            {
                if (gc.Player != null)
                {
                    if (args.Length > 1 && args[1].ToLower() == "full")
                    {
                        message.Add("(" + gc.SessionID + ") " + gc.TcpEndpointAddress + ", " + gc.Account.Name + ", " + gc.Player.Name + " " + gc.Version);
                    }
                    else
                    {
                        message.Add("(" + gc.SessionID + ") " + gc.Player.Name);
                    }
                }
            }

            client.Out.SendCustomTextWindow("[ Playing Client List ]", message);
            return;
        }
Exemplo n.º 20
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (client.Account.PrivLevel == 1 && ServerProperties.Properties.ANON_MODIFIER == -1)
            {
                DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Error"));
                return;
            }

            client.Player.IsAnonymous = !client.Player.IsAnonymous;
            string[] friendList = new string[]
            {
                client.Player.Name
            };
            if (client.Player.IsAnonymous)
            {
                client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.On"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                foreach (GameClient pclient in WorldMgr.GetAllPlayingClients())
                {
                    if (pclient.Player.Friends.Contains(client.Player.Name))
                    {
                        pclient.Out.SendRemoveFriends(friendList);
                    }
                }
            }
            else
            {
                client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Off"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                foreach (GameClient pclient in WorldMgr.GetAllPlayingClients())
                {
                    if (pclient.Player.Friends.Contains(client.Player.Name))
                    {
                        pclient.Out.SendAddFriends(friendList);
                    }
                }
            }
        }
Exemplo n.º 21
0
        public static void CreateServerStats(GameClient client)
        {
            GamePlayer player = client.Player;

            if (m_lastUpdatedTime == 0)
            {
                m_lastUpdatedTime = player.CurrentRegion.Time;
            }

            m_timeToChange = m_lastUpdatedTime + TIME_BETWEEN_UPDATES;

            if (player.CurrentRegion.Time < m_timeToChange && m_hasBeenRun)
            {
                return;
            }

            var chars = GameServer.Database.SelectObjects <DOLCharacters>("`RealmPoints` > @RealmPoints", new QueryParameter("@RealmPoints", 213881)).OrderByDescending(dc => dc.RealmPoints).Take(100).ToArray();

            // assuming we can get at least 20 players
            if (toplist.Count > 0)
            {
                toplist.Clear();
            }

            int count = 1;

            foreach (DOLCharacters chr in chars)
            {
                if (chr.IgnoreStatistics == false)
                {
                    var account = GameServer.Database.FindObjectByKey <Account>(chr.AccountName);

                    if (account != null && account.PrivLevel == 1)
                    {
                        toplist.Add("\n" + count.ToString() + " - [ " + chr.Name + " ] with " + string.Format("{0:0,0}", chr.RealmPoints) + " RP - [ " + (((chr.RealmLevel + 10) / 10) + "L" + ((chr.RealmLevel + 10) % 10)) + " ]");
                        if (++count > 20)
                        {
                            break;
                        }
                    }
                }
            }

            if (count == 1)
            {
                toplist.Add("None found!");
            }

            List <StatToCount> allstatsrp               = new List <StatToCount>();
            List <StatToCount> allstatslrp              = new List <StatToCount>();
            List <StatToCount> allstatskills            = new List <StatToCount>();
            List <StatToCount> allstatsdeath            = new List <StatToCount>();
            List <StatToCount> allstatsirs              = new List <StatToCount>();
            List <StatToCount> allstatsheal             = new List <StatToCount>();
            List <StatToCount> allstatsres              = new List <StatToCount>();
            List <StatToCount> allstatsrpearnedfromheal = new List <StatToCount>();

            foreach (GameClient c in WorldMgr.GetAllPlayingClients())
            {
                if (c == null || c.Account.PrivLevel != 1 || c.Player.IgnoreStatistics)
                {
                    continue;
                }

                PlayerStatistics stats = c.Player.Statistics as PlayerStatistics;
                if (stats != null)
                {
                    if (c.Player.RealmLevel > 31)
                    {
                        allstatsrp.Add(new StatToCount(c.Player.Name, stats.TotalRP));
                        TimeSpan onlineTime = DateTime.Now.Subtract(stats.LoginTime);
                        allstatslrp.Add(new StatToCount(c.Player.Name, (uint)Math.Round(stats.RPsPerHour(stats.TotalRP, onlineTime))));
                        uint deaths = stats.Deaths; if (deaths < 1)
                        {
                            deaths = 1;
                        }

                        allstatsirs.Add(new StatToCount(c.Player.Name, (uint)Math.Round((double)stats.TotalRP / (double)deaths)));
                    }

                    allstatskills.Add(new StatToCount(c.Player.Name, stats.KillsThatHaveEarnedRPs));
                    allstatsdeath.Add(new StatToCount(c.Player.Name, stats.Deathblows));
                    allstatsheal.Add(new StatToCount(c.Player.Name, stats.HitPointsHealed));
                    allstatsres.Add(new StatToCount(c.Player.Name, stats.RessurectionsPerformed));
                    allstatsrpearnedfromheal.Add(new StatToCount(c.Player.Name, stats.RPEarnedFromHitPointsHealed));
                }
            }

            allstatsrp.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatsrp.Reverse();
            allstatslrp.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatslrp.Reverse();
            allstatskills.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatskills.Reverse();
            allstatsdeath.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatsdeath.Reverse();
            allstatsirs.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatsirs.Reverse();
            allstatsheal.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatsheal.Reverse();
            allstatsres.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatsres.Reverse();
            allstatsrpearnedfromheal.Sort((ctc1, ctc2) => ctc1.count.CompareTo(ctc2.count)); allstatsrpearnedfromheal.Reverse();

            statsrp = string.Empty; statslrp = string.Empty; statskills = string.Empty; statsdeath = string.Empty; statsirs = string.Empty; statsheal = string.Empty; statsres = string.Empty;
            for (int c = 0; c < allstatsrp.Count; c++)
            {
                if (c > 19 || allstatsrp[c].count < 1)
                {
                    break;
                }
                statsrp += (c + 1) + ". " + allstatsrp[c].name + " with " + allstatsrp[c].count.ToString() + " RP\n";
            }
            for (int c = 0; c < allstatslrp.Count; c++)
            {
                if (c > 19 || allstatslrp[c].count < 1)
                {
                    break;
                }
                statslrp += (c + 1) + ". " + allstatslrp[c].name + " with " + allstatslrp[c].count.ToString() + " RP/hour\n";
            }
            for (int c = 0; c < allstatskills.Count; c++)
            {
                if (c > 19 || allstatskills[c].count < 1)
                {
                    break;
                }
                statskills += (c + 1) + ". " + allstatskills[c].name + " with " + allstatskills[c].count.ToString() + " kills\n";
            }
            for (int c = 0; c < allstatsdeath.Count; c++)
            {
                if (c > 19 || allstatsdeath[c].count < 1)
                {
                    break;
                }
                statsdeath += (c + 1) + ". " + allstatsdeath[c].name + " with " + allstatsdeath[c].count.ToString() + " deathblows\n";
            }
            for (int c = 0; c < allstatsirs.Count; c++)
            {
                if (c > 19 || allstatsirs[c].count < 1)
                {
                    break;
                }
                statsirs += (c + 1) + ". " + allstatsirs[c].name + " with " + allstatsirs[c].count.ToString() + " RP/death\n";
            }
            for (int c = 0; c < allstatsheal.Count; c++)
            {
                if (c > 19 || allstatsheal[c].count < 1)
                {
                    break;
                }
                statsheal += (c + 1) + ". " + allstatsheal[c].name + " with " + allstatsheal[c].count.ToString() + " HP and " + allstatsrpearnedfromheal[c].count.ToString() + " RP gained from heal\n";
            }
            for (int c = 0; c < allstatsres.Count; c++)
            {
                if (c > 19 || allstatsres[c].count < 1)
                {
                    break;
                }
                statsres += (c + 1) + ". " + allstatsres[c].name + " with " + allstatsres[c].count.ToString() + " res\n";
            }

            m_lastUpdatedTime = player.CurrentRegion.Time;
            m_hasBeenRun      = true;
        }
Exemplo n.º 22
0
        public void OnCommand(GameClient client, string[] args)
        {
            DateTime date;

            // if (m_counter > 0) return 0;
            if (args.Length >= 2)
            {
                if (args.Length == 2)
                {
                    try
                    {
                        m_counter = System.Convert.ToInt32(args[1]) * 60;
                    }
                    catch (Exception)
                    {
                        DisplaySyntax(client);
                        return;
                    }
                }
                else
                {
                    if ((args.Length == 3) && (args[1] == "on"))
                    {
                        string[] shutdownsplit = args[2].Split(':');

                        if ((shutdownsplit == null) || (shutdownsplit.Length < 2))
                        {
                            DisplaySyntax(client);
                            return;
                        }

                        int hour = Convert.ToInt32(shutdownsplit[0]);
                        int min  = Convert.ToInt32(shutdownsplit[1]);

                        // found next date with hour:min
                        date = DateTime.Now;

                        if ((date.Hour > hour) ||
                            (date.Hour == hour && date.Minute > min))
                        {
                            date = new DateTime(date.Year, date.Month, date.Day + 1);
                        }

                        if (date.Minute > min)
                        {
                            date = new DateTime(date.Year, date.Month, date.Day, date.Hour + 1, 0, 0);
                        }

                        date = date.AddHours(hour - date.Hour);
                        date = date.AddMinutes(min - date.Minute + 2);
                        date = date.AddSeconds(-date.Second);

                        m_counter = (date.ToFileTime() - DateTime.Now.ToFileTime()) / TimeSpan.TicksPerSecond;

                        if (m_counter < 60)
                        {
                            m_counter = 60;
                        }
                    }
                    else
                    {
                        DisplaySyntax(client);
                        return;
                    }
                }
            }
            else
            {
                DisplaySyntax(client);
                return;
            }

            if (m_counter % 5 != 0)
            {
                m_counter = m_counter / 5 * 5;
            }

            if (m_counter == 0)
            {
                m_counter = m_time * 60;
            }

            date = DateTime.Now;
            date = date.AddSeconds(m_counter);

            string msg   = "Server restart in " + m_counter / 60 + " mins!";
            bool   popup = (m_counter / 60) < 60;

            foreach (GameClient m_client in WorldMgr.GetAllPlayingClients())
            {
                if (popup)
                {
                    m_client.Out.SendDialogBox(eDialogCode.SimpleWarning, 0, 0, 0, 0, eDialogType.Ok, true, "Attention: Server restart in " + m_counter / 60 + " mins! (restart at " + date.ToString("HH:mm \"GMT\" zzz") + ")");
                    m_client.Out.SendMessage("Server restart in " + m_counter / 60 + " mins! (restart on " + date.ToString("HH:mm \"GMT\" zzz") + ")", eChatType.CT_System, eChatLoc.CL_PopupWindow);
                }

                m_client.Out.SendMessage(msg, eChatType.CT_Staff, eChatLoc.CL_ChatWindow);
            }

            log.Warn(msg);

            // You have an IRC Bot
            // if (ServerIRC.IRCBot != null) ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, msg);
            m_currentCallbackTime = 0;
            if (m_timer != null)
            {
                m_timer.Dispose();
            }

            m_timer = new Timer(new TimerCallback(CountDown), null, 0, 15000);
        }
Exemplo n.º 23
0
        public static void CountDown(object param)
        {
            // Subtract the current callback time
            m_counter -= m_currentCallbackTime / 1000;

            // Make sure we set this correctly
            m_shuttingDown = true;
            if (m_counter <= 0)
            {
                // You have an IRC Bot
                // if (ServerIRC.IRCBot != null) ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, "Server is restarting ...");
                m_timer.Dispose();
                new Thread(new ThreadStart(ShutDownServer)).Start();
                return;
            }
            else
            {
                if (m_counter > 120)
                {
                    log.Warn("Server restart in " + (int)(m_counter / 60) + " minutes!");
                }
                else
                {
                    log.Warn("Server restart in " + m_counter + " seconds!");
                }

                long secs  = m_counter;
                long mins  = secs / 60;
                long hours = mins / 60;

                string sendMessage = string.Empty;

                if (hours > 3)          // hours...
                {
                    if (mins % 60 < 15) // every hour..
                    {
                        sendMessage = "Server restart in " + hours + " hours!";
                    }

                    // 15 minutes between checks
                    m_currentCallbackTime = 15 * 60 * 1000;
                }
                else if (hours > 0)    // hours...
                {
                    if (mins % 30 < 5) // every 30 mins..
                    {
                        sendMessage = "Server restart in " + hours + " hours and " + (mins - (hours * 60)) + " minutes!";
                    }

                    // 5 minutes between checks
                    m_currentCallbackTime = 5 * 60 * 1000;
                }
                else if (mins >= 10)
                {
                    if (mins % 15 < 1) // every 15 mins..
                    {
                        sendMessage = "Server restart in " + mins + " minutes!";

                        // You have an IRC Bot
                        // if (ServerIRC.IRCBot != null) ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, sendMessage);
                    }

                    // 1 minute between checks
                    m_currentCallbackTime = 60 * 1000;
                }
                else if (mins >= 5)
                {
                    if (secs % 60 < 15) // every min...
                    {
                        sendMessage = "Server restart in " + mins + " minutes!";

                        // You have an IRC Bot
                        // if (ServerIRC.IRCBot != null && mins % 2 == 0) ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, sendMessage);
                    }

                    // 15 secs between checks
                    m_currentCallbackTime = 15 * 1000;
                }
                else if (secs > 60)
                {
                    sendMessage = "Server restart in " + mins + " minutes! (" + secs + " seconds)";

                    // You have an IRC Bot
                    // if (ServerIRC.IRCBot != null && secs % 60 == 0) ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, sendMessage);

                    // 15 secs between checks
                    m_currentCallbackTime = 15 * 1000;
                }
                else
                {
                    sendMessage = "Server restart in " + secs + " seconds! Please logout!";

                    // 5 secs between checks
                    m_currentCallbackTime = 5 * 1000;
                }

                // log.Debug(string.Format("counter: {0} callback: {1}", m_counter, m_currentCallbackTime));
                // log.Debug(sendMessage);

                // Change the timer to the new callback time
                m_timer.Change(m_currentCallbackTime, m_currentCallbackTime);

                if (sendMessage != string.Empty)
                {
                    foreach (GameClient client in WorldMgr.GetAllPlayingClients())
                    {
                        client.Out.SendMessage(sendMessage, eChatType.CT_Staff, eChatLoc.CL_ChatWindow);
                    }
                }

                if (mins <= 2 && GameServer.Instance.ServerStatus != eGameServerStatus.GSS_Closed) // 2 mins remaining
                {
                    GameServer.Instance.Close();
                    string msg = "Server is now closed (restart in " + mins + " mins)";

                    // You have an IRC Bot
                    // if (ServerIRC.IRCBot != null) ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, msg);
                }
            }
        }
Exemplo n.º 24
0
 protected virtual int Timer(RegionTimer callingTimer)
 {
     foreach (GameClient client in WorldMgr.GetAllPlayingClients())
     {
         if (client.Player.SkillSpecialtyPoints > MaxSpecPoints)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your amount of specialization points has been detected modified. (" + client.Player.SkillSpecialtyPoints + " points)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified specialization points. (" + client.Player.SkillSpecialtyPoints + " points). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Level > MaxLevel)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your level has been detected modified. (Level: " + client.Player.Level + ")", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified level. (Level: " + client.Player.Level + ")");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Strength > MaxStrength)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your strength has been detected modified. (" + client.Player.Strength + " strength)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified strength. (" + client.Player.Strength + " strength). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Dexterity > MaxDexterity)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your dexterity has been detected modified. (" + client.Player.Dexterity + " dexterity)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified dexterity. (" + client.Player.Dexterity + " dexterity). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Constitution > MaxConstitution)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your constitution has been detected modified. (" + client.Player.Constitution + " constitution)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified constitution. (" + client.Player.Constitution + " constitution). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Quickness > MaxQuickness)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your quickness has been detected modified. (" + client.Player.Quickness + " quickness)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified quickness. (" + client.Player.Quickness + " quickness). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Empathy > MaxEmpathy)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your empathy has been detected modified. (" + client.Player.Empathy + " empathy)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified empathy. (" + client.Player.Empathy + " empathy). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Charisma > MaxCharisma)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your charisma has been detected modified. (" + client.Player.Charisma + " charisma)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified charisma. (" + client.Player.Charisma + " charisma). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Piety > MaxPiety)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your piety has been detected modified. (" + client.Player.Piety + " piety)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified piety. (" + client.Player.Piety + " piety). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
         if (client.Player.Intelligence > MaxIntelligence)
         {
             if (client.Player.Client.Account.PrivLevel > 1)
             {
                 return(0);
             }
             if (client.ClientState == GameClient.eClientState.WorldEnter)
             {
                 // don't kick the player if they are still loading. It causes a weird client bug. Just wait until the next interval, and they will be removed.
                 return(0);
             }
             else
             {
                 client.Player.Out.SendMessage("Your intelligence has been detected modified. (" + client.Player.Intelligence + " intelligence)", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                 log.Warn(client.Player.Name + " detected with modified intelligence. (" + client.Player.Intelligence + " intelligence). Kicking Player.");
                 GameServer.Instance.Disconnect(client);
                 totaloffenses++;
             }
         }
     }
     return(INTERVAL);
 }
Exemplo n.º 25
0
        public override void Die(GameObject killer)

        {
            GamePlayer player = killer as GamePlayer;
            int        basebp = 0;

            if (Level <= 44)
            {
                basebp = 0;
            }
            if (Level == 45)
            {
                basebp = 25;
            }
            if (Level == 46)
            {
                basebp = 30;
            }
            if (Level == 47)
            {
                basebp = 35;
            }
            if (Level == 48)
            {
                basebp = 40;
            }
            if (Level == 49)
            {
                basebp = 45;
            }
            if (Level == 50)
            {
                basebp = 50;
            }
            if (Level == 51)
            {
                basebp = 55;
            }
            if (Level == 52)
            {
                basebp = 60;
            }
            if (Level == 53)
            {
                basebp = 65;
            }
            if (Level == 54)
            {
                basebp = 70;
            }
            if (Level == 55)
            {
                basebp = 90;
            }
            if (Level >= 56)
            {
                basebp = 120;
            }
            if (Level >= 59)
            {
                basebp = 160;
            }

            int  rewardbp;
            bool isjackpot;

            int multiplier = Util.Random(2, 5);
            int bonus      = Util.Random(1, 3);
            int chance     = Util.Random(1, 50);

            if (chance >= 40)
            {
                isjackpot = true;
            }
            else
            {
                isjackpot = false;
            }
            if (isjackpot)
            {
                rewardbp = ((basebp + bonus) * multiplier);
            }
            else
            {
                rewardbp = (basebp + bonus);
            }

            int playersonline = 0;

            foreach (GameClient playerclient in WorldMgr.GetAllPlayingClients())
            {
                if (playerclient.Account.PrivLevel == 1)
                {
                    ++playersonline;
                }
            }

            if (player is GamePlayer && IsWorthReward)

            {
                if (player.Group != null)
                {
                    if (player.Group.MemberCount == 1)
                    {
                        rewardbp = (rewardbp);
                    }
                    if (player.Group.MemberCount == 2)
                    {
                        rewardbp = (rewardbp / 2);
                    }
                    if (player.Group.MemberCount == 3)
                    {
                        rewardbp = (rewardbp / 3);
                    }
                    if (player.Group.MemberCount == 4)
                    {
                        rewardbp = (rewardbp / 4);
                    }
                    if (player.Group.MemberCount == 5)
                    {
                        rewardbp = (rewardbp / 5);
                    }
                    if (player.Group.MemberCount == 6)
                    {
                        rewardbp = (rewardbp / 6);
                    }
                    if (player.Group.MemberCount == 7)
                    {
                        rewardbp = (rewardbp / 7);
                    }
                    if (player.Group.MemberCount >= 8)
                    {
                        rewardbp = (rewardbp / 8);
                    }

                    foreach (GamePlayer player2 in player.Group.GetMembersInTheGroup())
                    {
                        if (player2.RealmPoints >= 1755250)
                        {
                            player2.Out.SendMessage("Hero, You are RR7 or higher, you will not be rewarded here anymore!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                            player2.MoveTo(79, 32401, 12245, 17413, 1902);
                        }
                        if (playersonline >= 50)
                        {
                            if ((player2.Client.Account.PrivLevel == 1) && (player2.CurrentRegionID == 249))
                            {
                                player2.Out.SendMessage("There are " + playersonline + " players online and your in the farmzone, why don't you go play with them!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                                player2.MoveTo(79, 32401, 12245, 17413, 1902);
                            }
                        }

                        if (player2.CurrentRegionID == 249)
                        {
                            player2.BountyPoints += rewardbp;
                        }
                        if (isjackpot)
                        {
                            player2.Out.SendMessage("JACKPOT!!!", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow); player2.Out.SendPlaySound(eSoundType.Craft, 0x04); player2.Out.SendMessage("You just got " + multiplier + "x multiplier bonus points!", eChatType.CT_ScreenCenterSmaller, eChatLoc.CL_SystemWindow);
                        }
                        player2.Out.SendMessage("Hero, You Get " + rewardbp + " bounty points!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        player2.Out.SendMessage("You Get " + rewardbp + " bounty points!", eChatType.CT_ScreenCenterSmaller, eChatLoc.CL_SystemWindow);
                    }
                }

                else
                {
                    if (player.RealmPoints >= 1755250)
                    {
                        player.Out.SendMessage("Hero, You are RR7 or higher, you will not be rewarded here anymore!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        player.MoveTo(79, 32401, 12245, 17413, 1902);
                    }
                    else
                    {
                        if (playersonline >= 50)
                        {
                            if ((player.Client.Account.PrivLevel == 1) && (player.CurrentRegionID == 249))
                            {
                                player.Out.SendMessage("There are " + playersonline + " players online and your in the farmzone, why don't you go play with them!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                                player.MoveTo(79, 32401, 12245, 17413, 1902);
                            }
                        }

                        if (player.CurrentRegionID == 249)
                        {
                            player.BountyPoints += rewardbp;
                        }
                        if (isjackpot)
                        {
                            player.Out.SendMessage("JACKPOT!!!", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow); player.Out.SendPlaySound(eSoundType.Craft, 0x04); player.Out.SendMessage("You just got " + multiplier + "x multiplier bonus points!", eChatType.CT_ScreenCenterSmaller, eChatLoc.CL_SystemWindow);
                        }
                        player.Out.SendMessage("Hero, You Get " + rewardbp + " bounty points!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        player.Out.SendMessage("You Get " + rewardbp + " bounty points!", eChatType.CT_ScreenCenterSmaller, eChatLoc.CL_SystemWindow);
                    }
                }

                //DropLoot(killer);
            }

            base.Die(killer);

            if ((Faction != null) && (killer is GamePlayer))

            {
                GamePlayer player3 = killer as GamePlayer;

                Faction.KillMember(player3);
            }

            StartRespawn();
        }
Exemplo n.º 26
0
        public void OnCommand(GameClient client, string[] args)
        {
            DateTime date;

            //if (m_counter > 0) return 0;
            if (args.Length >= 2)
            {
                if (args.Length == 2)
                {
                    try
                    {
                        m_counter = System.Convert.ToInt32(args[1]) * 60;
                    }
                    catch (Exception)
                    {
                        DisplaySyntax(client);
                        return;
                    }
                }

                else
                {
                    if ((args.Length == 3) && (args[1] == "on"))
                    {
                        string[] shutdownsplit = args[2].Split(':');

                        if ((shutdownsplit == null) || (shutdownsplit.Length < 2))
                        {
                            DisplaySyntax(client);
                            return;
                        }

                        int hour = Convert.ToInt32(shutdownsplit[0]);
                        int min  = Convert.ToInt32(shutdownsplit[1]);
                        // found next date with hour:min

                        date = DateTime.Now;

                        if ((date.Hour > hour) ||
                            (date.Hour == hour && date.Minute > min)
                            )
                        {
                            date = new DateTime(date.Year, date.Month, date.Day + 1);
                        }

                        if (date.Minute > min)
                        {
                            date = new DateTime(date.Year, date.Month, date.Day, date.Hour + 1, 0, 0);
                        }

                        date = date.AddHours(hour - date.Hour);
                        date = date.AddMinutes(min - date.Minute + 2);
                        date = date.AddSeconds(-date.Second);

                        m_counter = (date.ToFileTime() - DateTime.Now.ToFileTime()) / TimeSpan.TicksPerSecond;

                        if (m_counter < 60)
                        {
                            m_counter = 60;
                        }
                    }
                    else
                    {
                        DisplaySyntax(client);
                        return;
                    }
                }
            }
            else
            {
                DisplaySyntax(client);
                return;
            }

            if (m_counter % 5 != 0)
            {
                m_counter = (m_counter / 5 * 5);
            }

            if (m_counter == 0)
            {
                m_counter = m_time * 60;
            }

            date = DateTime.Now;
            date = date.AddSeconds(m_counter);

            foreach (GameClient m_client in WorldMgr.GetAllPlayingClients())
            {
                m_client.Out.SendMessage("Server Shutdown in " + m_counter / 60 + " mins! (Reboot on " + date.ToString("HH:mm \"GMT\" zzz") + ")", eChatType.CT_System, eChatLoc.CL_PopupWindow);
            }

            string msg = "Server Shutdown in " + m_counter / 60 + " mins! (Reboot on " + date.ToString("HH:mm \"GMT\" zzz") + ")";

            log.Info(msg);

            m_timer = new Timer(new TimerCallback(CountDown), null, 0, 15000);
        }
Exemplo n.º 27
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (IsSpammingCommand(client.Player, "who"))
            {
                return;
            }

            int       listStart      = 1;
            ArrayList filters        = null;
            ArrayList clientsList    = new ArrayList();
            ArrayList resultMessages = new ArrayList();

            // get list of clients depending on server type
            foreach (GameClient serverClient in WorldMgr.GetAllPlayingClients())
            {
                GamePlayer addPlayer = serverClient.Player;
                if (addPlayer == null)
                {
                    continue;
                }
                if (serverClient.Account.PrivLevel > (uint)ePrivLevel.Player && serverClient.Player.IsAnonymous == false)
                {
                    clientsList.Add(addPlayer.Client);
                    continue;
                }
                if (addPlayer.Client != client &&              // always add self
                    client.Account.PrivLevel == (uint)ePrivLevel.Player &&
                    (addPlayer.IsAnonymous || !GameServer.ServerRules.IsSameRealm(addPlayer, client.Player, true)))
                {
                    continue;
                }
                clientsList.Add(addPlayer.Client);
            }

            // no params
            if (args.Length == 1)
            {
                int playing = clientsList.Count;

                // including anon?
                DisplayMessage(client, string.Format(MESSAGE_PLAYERS_ONLINE, playing, playing > 1 ? "s" : ""));
                DisplayMessage(client, MESSAGE_NO_ARGS);
                return;
            }


            // any params passed?
            switch (args[1].ToLower())
            {
            case "all":                     // display all players, no filter
            {
                filters = null;
                break;
            }

            case "help":                     // list syntax for the who command
            {
                DisplaySyntax(client);
                return;
            }

            case "staff":
            case "gm":
            case "admin":
            {
                filters = new ArrayList(1);
                filters.Add(new GMFilter());
                break;
            }

            case "en":
            case "cz":
            case "de":
            case "es":
            case "fr":
            case "it":
            {
                filters = new ArrayList(1);
                filters.Add(new LanguageFilter(args[1].ToLower()));
                break;
            }

            case "cg":
            {
                filters = new ArrayList(1);
                filters.Add(new ChatGroupFilter());
                break;
            }

            case "nf":
            {
                filters = new ArrayList(1);
                filters.Add(new NewFrontiersFilter());
                break;
            }

            case "rp":
            {
                filters = new ArrayList(1);
                filters.Add(new RPFilter());
                break;
            }

            default:
            {
                filters = new ArrayList();
                AddFilters(filters, args, 1);
                break;
            }
            }


            int resultCount = 0;

            foreach (GameClient clients in clientsList)
            {
                if (ApplyFilter(filters, clients.Player))
                {
                    resultCount++;
                    if (resultMessages.Count < MAX_LIST_SIZE && resultCount >= listStart)
                    {
                        resultMessages.Add(resultCount + ") " + FormatLine(clients.Player, client.Account.PrivLevel, client));
                    }
                }
            }

            foreach (string str in resultMessages)
            {
                DisplayMessage(client, str);
            }

            if (resultCount == 0)
            {
                DisplayMessage(client, MESSAGE_NO_MATCHES);
            }
            else if (resultCount > MAX_LIST_SIZE)
            {
                DisplayMessage(client, string.Format(MESSAGE_LIST_TRUNCATED, resultCount));
            }

            filters = null;
        }
Exemplo n.º 28
0
        public static void CountDown(object param)
        {
            if (m_counter <= 0)
            {
                m_timer.Dispose();
                new Thread(new ThreadStart(ShutDownServer)).Start();
                return;
            }
            else
            {
                log.Info("Server reboot in " + m_counter + " seconds!");
                long secs  = m_counter;
                long mins  = secs / 60;
                long hours = mins / 60;

                foreach (GameClient client in WorldMgr.GetAllPlayingClients())
                {
                    if (hours > 3)                            //hours...
                    {
                        if (mins % 60 == 0 && secs % 60 == 0) //every hour..
                        {
                            client.Out.SendMessage("Server reboot in " + hours + " hours!", eChatType.CT_Broadcast,
                                                   eChatLoc.CL_ChatWindow);
                        }
                    }
                    else if (hours > 0)                       //hours...
                    {
                        if (mins % 30 == 0 && secs % 60 == 0) //every 30 mins..
                        {
                            client.Out.SendMessage("Server reboot in " + hours + " hours and " + (mins - (hours * 60)) + "mins!", eChatType.CT_Staff,
                                                   eChatLoc.CL_ChatWindow);
                        }
                    }
                    else if (mins >= 10)
                    {
                        if (mins % 15 == 0 && secs % 60 == 0) //every 15 mins..
                        {
                            client.Out.SendMessage("Server reboot in " + mins + " mins!", eChatType.CT_Broadcast,
                                                   eChatLoc.CL_ChatWindow);
                        }
                    }
                    else if (mins >= 3)
                    {
                        if (secs % 60 == 0) //every min...
                        {
                            client.Out.SendMessage("Server reboot in " + mins + " mins!", eChatType.CT_Broadcast,
                                                   eChatLoc.CL_ChatWindow);
                        }
                    }
                    else if (secs > 60)
                    {
                        client.Out.SendMessage("Server reboot in " + mins + " minutes! (" + secs + " secs)", eChatType.CT_Broadcast,
                                               eChatLoc.CL_ChatWindow);
                    }
                    else
                    {
                        client.Out.SendMessage("Server reboot in " + secs + " secs! Please logout!", eChatType.CT_Broadcast,
                                               eChatLoc.CL_ChatWindow);
                    }
                }

                if (mins <= 5 && GameServer.Instance.ServerStatus != eGameServerStatus.GSS_Closed) // 5 mins remaining
                {
                    GameServer.Instance.Close();
                    string msg = "Server is now closed (reboot in " + mins + " mins)";

                    /*if (ServerIRC.IRCBot != null)
                     *  ServerIRC.IRCBot.SendMessage(ServerIRC.CHANNEL, msg);*/
                }
            }
            m_counter -= 15;
        }
Exemplo n.º 29
0
        //After registering for the OnPlayerEnterWorldFirstTime event this
        //function is called whenever a character enters the game
        public static void DOLTestPlayerEnterWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

            if (player.Level < 50)
            {
                foreach (GameClient thisClient in WorldMgr.GetAllPlayingClients())
                {
                    if (thisClient.Player.Realm == player.Realm)
                    {
                        thisClient.Player.Out.SendMessage(player.Name + " <level " + player.Level + ">" + " enter the game.", eChatType.CT_Broadcast, eChatLoc.CL_SystemWindow);
                    }
                }
            }

            if (player.Experience == 0)
            {
                bool bTest = false;
                if (player.Name.Length >= 4)
                {
                    if (player.Name.Substring(0, 4).ToLower() == "test")
                    {
                        bTest = true;
                    }
                }

                // I45, I50

                if (bTest)
                {
                    player.GainExperience(GameLiving.eXPSource.Other, 169999999950);
                }
                else
                {
                    player.GainExperience(GameLiving.eXPSource.Other, 53999999950);
                }


                // CRAFT
                for (int i = 0; i < 15; i++)
                {
                    eCraftingSkill craftingSkillID = (eCraftingSkill)Convert.ToUInt16(i + 1);
                    player.GainCraftingSkill(craftingSkillID, 99);
                }
                player.Out.SendUpdateCraftingSkills();
                player.Out.SendUpdatePlayer();
                player.Out.SendUpdatePoints();
                player.Out.SendCharStatsUpdate();
                player.UpdatePlayerStatus();

                player.SaveIntoDatabase();
            }

            //Now we check if our player is a certain distance from
            //DOLTopia (our selfproclaimed town to show off)
            //If the player is > 10.000 coordinates away or in another region
            //we send a dialog to the player and register a dialog-callback
        }
Exemplo n.º 30
0
        /// <summary>
        /// Reads in the template and generates the appropriate html
        /// </summary>
        public static void Generate()
        {
            try
            {
                var db = ObjectDatabase.GetObjectDatabase(ConnectionType.DATABASE_XML, "." + Path.DirectorySeparatorChar + "webui" + Path.DirectorySeparatorChar + "generated");

                //Obsolete with GSS Table Registering in SVN : 3337
                //db.RegisterDataObject(typeof (ServerInfo));
                //Obsolete with GSS Table Registering in SVN : 3337
                //db.RegisterDataObject(typeof (PlayerInfo));

                ServerInfo si = new ServerInfo();

                si.Time              = DateTime.Now.ToString();
                si.ServerName        = GameServer.Instance.Configuration.ServerName;
                si.NumClients        = GameServer.Instance.ClientCount;
                si.NumAccounts       = GameServer.Database.GetObjectCount <Account>();
                si.NumMobs           = GameServer.Database.GetObjectCount <Mob>();
                si.NumInventoryItems = GameServer.Database.GetObjectCount <InventoryItem>();
                si.NumPlayerChars    = GameServer.Database.GetObjectCount <DOLCharacters>();
                si.NumMerchantItems  = GameServer.Database.GetObjectCount <MerchantItem>();
                si.NumItemTemplates  = GameServer.Database.GetObjectCount <ItemTemplate>();
                si.NumWorldObjects   = GameServer.Database.GetObjectCount <WorldObject>();
                si.ServerType        = GameServer.Instance.Configuration.ServerType.ToString();
                si.ServerStatus      = GameServer.Instance.ServerStatus.ToString();
                si.AAC = GameServer.Instance.Configuration.AutoAccountCreation ? "enabled" : "disabled";

                db.AddObject(si);

                PlayerInfo pi = new PlayerInfo();

                foreach (GameClient client in WorldMgr.GetAllPlayingClients())
                {
                    GamePlayer plr = client.Player;

                    pi.Name     = plr.Name;
                    pi.LastName = plr.LastName;
                    pi.Class    = plr.CharacterClass.Name;
                    pi.Race     = plr.RaceName;
                    pi.Guild    = plr.GuildName;
                    pi.Level    = plr.Level;
                    pi.Alive    = plr.IsAlive ? "yes" : "no";
                    pi.Realm    = ((eRealm)plr.Realm).ToString();
                    pi.Region   = plr.CurrentRegion.Name;
                    pi.X        = plr.X;
                    pi.Y        = plr.Y;
                }

                // 2008-01-29 Kakuri - Obsolete
                //db.WriteDatabaseTables();
                db = null;

                if (log.IsInfoEnabled)
                {
                    log.Info("WebUI Generation initialized");
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("WebUI Generation: ", e);
                }
            }
        }