예제 #1
0
        public ChatGump(Mobile from, ChatSystem system)
            : base(50, 100)
        {
            m_Caller = from;
            m_System = system;

            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;

            AddBackground(0, 0, 190, 355, 9200);
            AddButton(16, 269, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddLabel(40, 11, 0, @"UO: Origins Chat");

            string players = "";

            List<Mobile> toRemove = new List<Mobile>();

            foreach (Mobile m in m_System.m_Players.Keys.ToList())
            {
                if (m.Deleted || m == null)
                {
                    toRemove.Add(m);
                    continue;
                }

                bool visible = true;
                m_System.m_Players.TryGetValue(m,out visible);

                if (visible)
                    players += String.Format("{1} <BR>", players, (m == null ? "" : (m.AccessLevel > AccessLevel.Player ? "@" + m.Name : m.Name)));
                else if (from.AccessLevel > AccessLevel.Player)
                    players += String.Format("{1} <BR>", players, (m == null ? "" :  "#" + m.Name));
            }

            foreach (Mobile m in toRemove)
            {
                m_System.m_Players.Remove(m);
            }

            AddHtml(10, 50, 163, 188, players, (bool)true, (bool)true);

            AddLabel(10, 30, 0, @"Players Available");
            AddLabel(14, 244, 0, @"Type [chat <msg> to talk");

            bool isvisible = true;
            m_System.m_Players.TryGetValue(from, out isvisible);

            AddLabel(54, 270, 0, (isvisible ? @"Hide Name" : @"Show Name"));

            AddLabel(56, 298, 0, @"Quit Chat");

            PlayerMobile pm = from as PlayerMobile;

            AddHtml( 48, 325, 126, 18, @"<basefont color=black size=5>Receive on Login</basefont>", false, false );
            AddCheck( 16, 320, 2152, 2154, ( pm != null ? pm.ShowChat : true ), 0 );

            AddButton(16, 296, 4017, 4019, 0, GumpButtonType.Reply, 0);
        }
예제 #2
0
	void Start()
	{
		esyst = FindObjectOfType<EventSystem>();
		ChatMsgs = new List<Message>();
		cs = FindObjectOfType<ChatSystem>();
		MessageObjects = new List<GameObject>();
		ChangeType(PlrMessageType.Default);
	}
 public ConversationCollectionViewModel(ChatSystem chatSystem, Action <Conversation> enterConversation)
 {
     this.chatSystem             = chatSystem;
     chatSystem.PropertyChanged += OnPropertyChanged;
     this.enterConversation      = enterConversation;
     this.conversations          = new ObservableCollection <ConversationViewModel>(
         chatSystem.Conversations.Select(conv => new ConversationViewModel(conv.Value, enterConversation)).ToList()
         );
 }
예제 #4
0
        public static void Kick(ChatUser from, Channel channel, string param)
        {
            var target = ChatSystem.SearchForUser(from, param);

            if (target != null)
            {
                channel.Kick(target, from);
            }
        }
예제 #5
0
        public static void RemoveVoice(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target != null)
            {
                channel.RemoveVoiced(target, from);
            }
        }
예제 #6
0
        public static void RemoveModerator(ChatUser from, Channel channel, string param)
        {
            var target = ChatSystem.SearchForUser(from, param);

            if (target != null)
            {
                channel.RemoveModerator(target, from);
            }
        }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     animator   = GetComponent <Animator>();
     controller = GetComponent <CharacterController>();
     // Battle
     magicSpawnPosition = GameObject.Find("MagicSpawn").GetComponent <Transform>();
     // Chat
     chatSystem     = GameObject.FindObjectOfType <ChatSystem>();
     chatIdentifier = GameObject.FindObjectOfType <ChatIdentifier>();
 }
예제 #8
0
    private bool ChatSystemIsOpen()
    {
        if (chatSystem == null)
        {
            chatSystem  = GameObject.FindObjectOfType <ChatSystem>();
            canvasGroup = chatSystem.canvasGroup;
        }

        return(canvasGroup.alpha > 0.01f);
    }
예제 #9
0
 static void TempAsyncSetCallback()
 {
     AClip = AudioClip.Create("Record", oLeng, 1, Frequency, false, false);
     AClip.SetData(FS, 0);
     if (ChatSystem.AsyncSetCallBack != null)
     {
         ChatSystem.AsyncSetCallBack();
         ChatSystem.AsyncSetCallBack = null;
     }
 }
예제 #10
0
 public void Open(string user)
 {
     if (!currentAsk && !FindObjectOfType <PartyMatchmaker>().inParty())
     {
         AskedUser     = user;
         DispText.text = ChatSystem.playerToText(AskedUser) + " invited you to a party.";
         currentAsk    = true;
         panel.SetStateToClose();
         panel.Open();
     }
 }
예제 #11
0
        public static void RemoveIgnore(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target == null)
            {
                return;
            }

            from.RemoveIgnored(target);
        }
예제 #12
0
        public override double ServerUpdateIntervalSeconds => double.MaxValue; // never

        protected override void ServerInitialize(ServerInitializeData data)
        {
            if (data.IsFirstTimeInit)
            {
                data.PrivateState.Members = new NetworkSyncList <string>();
                data.PrivateState.ServerPartyChatHolder = ChatSystem.ServerCreateChatRoom(
                    new ChatRoomParty(party: data.GameObject));
            }

            PartySystem.ServerRegisterParty(data.GameObject);
        }
예제 #13
0
 void Awake()
 {
     if (singleton != null && singleton != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         singleton = this;
     }
 }
예제 #14
0
    void TishiMwssage()
    {
//		if(IsAlreadyLearnedSkills())
//		{
//			BeginBtn.gameObject.SetActive(false);
//		}

        PopText.Instance.Show(LanguageManager.instance.GetValue("learnSuccess"));
        SkillXiDeUI(SkpData._Id);
        ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("wuxude").Replace("{n}", SkillData.GetMinxiLevelData(SkpData._Id)._Name));
        GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_MainLearningSkillOk);
    }
예제 #15
0
        public override double ServerUpdateIntervalSeconds => double.MaxValue; // never

        protected override void ServerInitialize(ServerInitializeData data)
        {
            data.PrivateState.Init();

            if (data.IsFirstTimeInit)
            {
                data.PrivateState.ServerFactionChatHolder = ChatSystem.ServerCreateChatRoom(
                    new ChatRoomFaction(faction: data.GameObject));
            }

            FactionSystem.ServerRegisterFaction(data.GameObject);
        }
예제 #16
0
 public void InvitePlayer(string user)
 {
     if (FindObjectOfType <PartyMatchmaker>().partyList.Count < 4)
     {
         WhisperTarget = user;
         cs.Whisper(WhisperTarget, "/invite");
         cs.SendSystemMessage("Invited " + ChatSystem.playerToText(user) + " to join your party.");
     }
     else
     {
         cs.SendSystemMessage("Parties are limited to 4 players");
     }
 }
예제 #17
0
 // Use this for initialization
 void Start()
 {
     animator           = GetComponent <Animator>();
     controller         = GetComponent <CharacterController>();
     magicSpawnPosition = GameObject.Find("ExcaliburSawn").GetComponent <Transform>();
     //if(GameObject.Find("NaokoStaff_Player")){
     //	Debug.Log("find naoko");
     yuriPushBackScript = GameObject.Find("BattleManager").GetComponent <YuriPushBack>();
     //}
     // Chat
     chatSystem     = GameObject.FindObjectOfType <ChatSystem>();
     chatIdentifier = GameObject.FindObjectOfType <ChatIdentifier>();
 }
예제 #18
0
    public static void AsyncGetClip()
    {
        int eLeng = SE.Encode(FS, 0, length, BS, 0, length);

        byte[] samples = new byte[eLeng];
        Array.Copy(BS, 0, samples, 0, eLeng);
        ClientLog.Instance.Log("GetClip === " + eLeng + " bytes.");
        if (ChatSystem.AsyncGetCallBack != null)
        {
            ChatSystem.AsyncGetCallBack(samples);
            ChatSystem.AsyncGetCallBack = null;
        }
    }
예제 #19
0
            public static InvitationCreateResult AddInvitation(ICharacter invitee, ICharacter inviter)
            {
                var party = ServerGetParty(inviter);

                if (party == null)
                {
                    Logger.Warning("Player don't have a party and so cannot invite anyone", inviter);
                    return(InvitationCreateResult.Unknown);
                }

                if (ServerPlayerMuteSystem.IsMuted(invitee.Name, out _))
                {
                    return(InvitationCreateResult.ErrorMuted);
                }

                var invitation = GetInvitation(party, invitee);

                if (invitation != null)
                {
                    invitation.ResetExpirationDate();
                    Logger.Info(
                        $"{invitee} is already has been invited by {inviter} to {party} - invitation timeout extended");
                    return(InvitationCreateResult.Success);
                }

                var members = ServerGetPartyMembersReadOnly(party);

                if (members.Contains(invitee.Name, StringComparer.Ordinal))
                {
                    return(InvitationCreateResult.ErrorInviteeAlreadySamePartyMember);
                }

                var partyMembers = ServerGetPartyMembersReadOnly(party);

                if (partyMembers.Count + 1 >= PartyConstants.PartyMembersMax)
                {
                    return(InvitationCreateResult.ErrorPartyFull);
                }

                invitation = new Invitation(party, inviter, invitee);
                InvitationsList.Add(invitation);

                Instance.CallClient(invitation.Invitee,
                                    _ => _.ClientRemote_InvitationAdded(invitation.Inviter.Name));
                Logger.Important($"{invitee} has been invited by {inviter} to {party}");
                ChatSystem.ServerSendServiceMessage(
                    ServerGetPartyChat(party),
                    string.Format(Notification_PlayerInvitedFormat, inviter.Name, invitee.Name));

                return(InvitationCreateResult.Success);
            }
예제 #20
0
    private const uint TERRORIST_INDEX         = 3; // the channel index for terrorists

    void Start()
    {
        if (!isLocalPlayer)
        {
            this.enabled = false;
        }
        chatSystem     = GameObject.FindObjectOfType <ChatSystem>();
        chatIdentifier = GameObject.FindObjectOfType <ChatIdentifier>();
        teamIdentifier = GameObject.FindObjectOfType <TeamIdentifier>();
        nameSetter     = GameObject.Find("Player Name Setter").GetComponent <InputField>();
        nameSetter.onEndEdit.AddListener(value =>
        {
            name = value;
        });
    }
예제 #21
0
        public void ThreadMain()
        {
            try
            {
                WarpSystem.Reset();
                ChatSystem.Reset();

                while (ServerContext.ServerRunning)
                {
                    //Check timers
                    NukeCommand.CheckTimer();
                    DekesslerCommand.CheckTimer();

                    LmpPluginHandler.FireOnUpdate(); //Run plugin update

                    Thread.Sleep(GeneralSettings.SettingsStore.MainTimeTick);
                }
            }
            catch (Exception e)
            {
                LunaLog.Error($"Fatal error thrown, exception: {e}");
                new ShutDownCommand().Execute("Crashed!");
            }

            try
            {
                var disconnectTime  = DateTime.UtcNow.Ticks;
                var sendingMessages = true;
                while (sendingMessages)
                {
                    if (DateTime.UtcNow.Ticks - disconnectTime > TimeSpan.FromSeconds(5).Ticks)
                    {
                        LunaLog.Debug($"Shutting down with {ServerContext.PlayerCount} Players, " +
                                      $"{ServerContext.Clients.Count} connected Clients");
                        break;
                    }
                    sendingMessages = ClientRetriever.GetAuthenticatedClients().Any(c => c.SendMessageQueue.Count > 0);

                    Thread.Sleep(GeneralSettings.SettingsStore.MainTimeTick);
                }
                ServerContext.LidgrenServer.ShutdownLidgrenServer();
            }
            catch (Exception e)
            {
                LunaLog.Fatal($"Fatal error thrown during shutdown, exception: {e}");
                throw;
            }
        }
예제 #22
0
    //A. this is registering the services
    //meaning all I is resolved

    //Q. can we pass params to services?

    //B.
    //the initialization issue, this should be after injection, means after awake
    private async UniTask Initialize(ActiveRoomState activeRoomState)
    {
        // Controller.I.OnAppPause += DestroyModuleGroup;

        var containerRoot = new GameObject("Room").transform;

        new RoomReferences();
        RoomReferences.I.Canvas = (await Addressables.InstantiateAsync("canvas", containerRoot))
                                  .GetComponent <Transform>();
        RoomReferences.I.Root = containerRoot;

        PrizeView.Create();

        await ChatSystem.Create();

        await Ground.Create();

        new CoreGameplay();

        new RoomUserView.Manager();

        //dependent on RoomSettings
        //this will make registering requires order, so no circular dependencies possible

        RoomUserView.Manager.I.Init();

        await CoreGameplay.I.CreatePlayers();

        Repository.I.PersonalFullInfo.Money -= RoomSettings.I.BetMoneyToPay();

        Background.I.SetForRoom(RoomSettings.I.UserInfos);

        // AssignRpcs();

        if (activeRoomState == null)
        {
            Controller.I.SendAsync("Ready").Forget(e => throw e);
        }
        else
        {
            //todo why this
            // await UniTask.DelayFrame(1);

            CoreGameplay.I.ResumeGame(activeRoomState.MyHand, activeRoomState.Ground,
                                      activeRoomState.HandCounts,
                                      activeRoomState.CurrentTurn);
        }
    }
예제 #23
0
        public static void DisconnectClient(ClientStructure client, string reason = "")
        {
            if (!string.IsNullOrEmpty(reason))
            {
                LunaLog.Debug($"{client.PlayerName} sent Connection end message, reason: {reason}");
            }

            VesselUpdateRelaySystem.RemovePlayer(client);

            //Remove Clients from list
            if (ServerContext.Clients.ContainsKey(client.Endpoint))
            {
                ServerContext.Clients.TryRemove(client.Endpoint, out client);
                LunaLog.Debug($"Online Players: {ServerContext.PlayerCount}, connected: {ServerContext.Clients.Count}");
            }

            if (client.ConnectionStatus != ConnectionStatus.Disconnected)
            {
                client.ConnectionStatus = ConnectionStatus.Disconnected;
                LmpPluginHandler.FireOnClientDisconnect(client);
                if (client.Authenticated)
                {
                    ChatSystem.RemovePlayer(client.PlayerName);

                    var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <PlayerConnectionLeaveMsgData>();
                    msgData.PlayerName = client.PlayerName;

                    MessageQueuer.RelayMessage <PlayerConnectionSrvMsg>(client, msgData);
                    LockSystem.ReleasePlayerLocks(client);

                    if (!ServerContext.Clients.Any(c => c.Value.Subspace == client.Subspace))
                    {
                        WarpSystem.RemoveSubspace(client.Subspace);
                        VesselRelaySystem.RemoveSubspace(client.Subspace);
                    }
                }

                try
                {
                    client.Connection?.Disconnect(reason);
                }
                catch (Exception e)
                {
                    LunaLog.Debug($"Error closing client Connection: {e.Message}");
                }
                ServerContext.LastPlayerActivity = ServerContext.ServerClock.ElapsedMilliseconds;
            }
        }
예제 #24
0
    public void onToggle()
    {
        if (chatSystem == null)
        {
            chatSystem = GameObject.FindObjectOfType <ChatSystem>();
        }

        if (chatSystem != null)
        {
            chatSystem.ToggleWordFilter(toggle.isOn);
        }
        else
        {
            Debug.LogWarning("No chat system found, cannot update status of Word Filter");
        }
    }
예제 #25
0
    void BabyskillLearn(int nbabyId, int newskId)
    {
        GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_BabyLearningSkillOk);
        BSkillCell bcell = items [itemId].GetComponent <BSkillCell> ();

        if (bcell.SData != null)
        {
            Inst.SkillInsts.RemoveAt(itemId);
        }

        RefreshItem(BabyList.babyId);
        PopText.Instance.Show(LanguageManager.instance.GetValue("learnSuccess"));
        ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("chongwuxude").Replace("{n}", SkillData.GetMinxiLevelData(newskId)._Name));
        BabySkillLearning.Instance.CloseBabyListObj();
        BabySkillLearning.Instance.CloseBabyskillObj();
    }
예제 #26
0
 private void LoadChat()
 {
     try
     {
         while (true)
         {
             textBox1.Invoke((MethodInvoker)(() =>
             {
                 textBox1.Text = "";
                 textBox1.Text = ChatSystem.GetMessages();
             }));
             Thread.Sleep(5000);
         }
     }
     catch { }
 }
예제 #27
0
        private static void WriteLog(LogLevels level, string message, bool sendToConsole)
        {
            if (level >= GeneralSettings.SettingsStore.LogLevel)
            {
                var output = GeneralSettings.SettingsStore.UseUtcTimeInLog
                    ? $"[{DateTime.UtcNow:HH:mm:ss}][{level}] : {message}"
                    : $"[{DateTime.Now:HH:mm:ss}][{level}] : {message}";

                if (sendToConsole)
                {
                    Console.WriteLine(output);
                    ChatSystem.SendConsoleMessageToAdmins(output);
                }

                FileHandler.AppendToFile(LogFilename, output + Environment.NewLine);
            }
        }
예제 #28
0
            public static InvitationAcceptResult Accept(ICharacter invitee, ICharacter inviter)
            {
                var party      = ServerGetParty(inviter);
                var invitation = GetInvitation(party, invitee);

                if (invitation is null)
                {
                    return(InvitationAcceptResult.ErrorNoInvitationFoundOrExpired);
                }

                // should never happen
                Api.Assert(party is not null, "Inviter must have a party");
                var currentInviteeParty = ServerGetParty(invitee);

                Api.Assert(party != currentInviteeParty, "Cannot join the same party");

                var inviterPartyMembers = ServerGetPartyMembersReadOnly(party);

                if (inviterPartyMembers.Count >= PartyConstants.SharedPartyMembersMax)
                {
                    return(InvitationAcceptResult.ErrorPartyFull);
                }

                if (currentInviteeParty is not null)
                {
                    // invitee already has a party - leave it first
                    ServerLeaveParty(invitee);
                }

                RemoveInvitation(invitation, notifyInvitee: false);
                RemoveAllInvitationsFor(invitee);

                var messageJoinedParty = string.Format(Notification_PlayerAcceptedInviteFormat,
                                                       invitee.Name,
                                                       inviter.Name);

                ChatSystem.ServerSendServiceMessage(ServerGetPartyChat(party),
                                                    messageJoinedParty,
                                                    forCharacterName: invitee.Name);

                SendPrivateChatServiceMessage(invitee, party, messageJoinedParty);

                ServerAddMember(invitee, party);

                return(InvitationAcceptResult.Success);
            }
예제 #29
0
        public static void QueryWhoIs(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target == null)
            {
                return;
            }

            if (target.Anonymous)
            {
                from.SendMessage(41, target.Username); // %1 is remaining anonymous.
            }
            else
            {
                from.SendMessage(43, target.Username, target.Mobile.Name); // %2 is known in the lands of Britannia as %2.
            }
        }
예제 #30
0
        public static void ToggleModerator(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target == null)
            {
                return;
            }

            if (channel.IsModerator(target))
            {
                channel.RemoveModerator(target, from);
            }
            else
            {
                channel.AddModerator(target, from);
            }
        }
예제 #31
0
        public static void ToggleIgnore(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target == null)
            {
                return;
            }

            if (from.IsIgnored(target))
            {
                from.RemoveIgnored(target);
            }
            else
            {
                from.AddIgnored(target);
            }
        }
예제 #32
0
        public static void ToggleVoice(ChatUser from, Channel channel, string param)
        {
            var target = ChatSystem.SearchForUser(from, param);

            if (target == null)
            {
                return;
            }

            if (channel.IsVoiced(target))
            {
                channel.RemoveVoiced(target, from);
            }
            else
            {
                channel.AddVoiced(target, from);
            }
        }
예제 #33
0
파일: ChatGump.cs 프로젝트: Godkong/Origins
 public GetMobile(ChatSystem chat)
     : base(15, false, TargetFlags.None)
 {
     m_System = chat;
 }
예제 #34
0
 //===========
 void Awake()
 {
     chatSys = GetComponent<ChatSystem>();
     // On Awake, we want to ensure the master server is empty, and a placeholder username is chosen
     MasterServer.ClearHostList();
     testMessage.text = "Testing network connection capabilities.";
     //		username = "******"+Random.Range(0,99).ToString();	// We're randomizing a digit at the end, just to give some variety
 }
예제 #35
0
        public override void OnDeath( Container c )
        {
            base.OnDeath( c );

            if (!AssumePlayAsGhost)
            {
                CantWalk = true;
                new ResNowOption.ResNowOptionTimer(this).Start();
            }

            //DeathCount++;
            HueMod = -1;
            NameMod = null;
            SavagePaintExpiration = TimeSpan.Zero;

            SetHairMods( -1, -1 );

            PolymorphSpell.StopTimer( this );
            IncognitoSpell.StopTimer( this );
            DisguiseTimers.RemoveTimer( this );

            EndAction( typeof( PolymorphSpell ) );
            EndAction( typeof( IncognitoSpell ) );

            MeerMage.StopEffect( this, false );

            //SkillHandlers.StolenItem.ReturnOnDeath( this, c );

            if (m_PermaFlags.Count > 0)
            {
                m_PermaFlags.Clear();

                if (c is Corpse)
                    ((Corpse)c).Criminal = true;

                if (SkillHandlers.Stealing.ClassicMode)
                    Criminal = true;
            }

            if ( m_InsuranceCost > 0 )
                SendLocalizedMessage( 1060398, m_InsuranceCost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.

            if ( m_InsuranceAward is PlayerMobile )
            {
                PlayerMobile pm = (PlayerMobile)m_InsuranceAward;

                if ( pm.m_InsuranceBonus > 0 )
                    pm.SendLocalizedMessage( 1060397, pm.m_InsuranceBonus.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
            }

            Mobile killer = this.FindMostRecentDamager( true );

            //statloss
            /*double loss;
            if (Bounty >= 5000)
            {
                loss = 1 - (((double)Bounty / 10000) / 100);
                loss -= (Utility.Random(9) / 1000);

                if (RawStr * loss > 10)
                    RawStr = (int)(RawStr * loss);
                if (RawInt * loss > 10)
                    RawInt = (int)(RawInt * loss);
                if (RawDex * loss > 10)
                    RawDex = (int)(RawDex * loss);

                for (int s = 0; s < Skills.Length; s++)
                {
                    if (Skills[s].Base * loss > 35)
                        Skills[s].Base *= loss;
                }
            }*/

            //STAT LOSS STUFF
            if (BountyMark)
            {
                if (killer is PlayerMobile)
                {
                    PlayerMobile killr = killer as PlayerMobile;

                    //do they have more kills than you and are they more than neutral notoriety
                    if ((killr.Kills < this.Kills) && (killr.Karma >= 0))
                    {
                        /*double loss = 0.90; // 10% loss

                        if (RawStr * loss > 10)
                            RawStr = (int)(RawStr * loss);
                        if (RawInt * loss > 10)
                            RawInt = (int)(RawInt * loss);
                        if (RawDex * loss > 10)
                            RawDex = (int)(RawDex * loss);

                        for (int s = 0; s < Skills.Length; s++)
                        {
                            if (Skills[s].Base * loss > 35)
                                Skills[s].Base *= loss;
                        }*/

                        //give killer head of the murderer
                        if (killr.Backpack != null)
                        {
                            killr.Backpack.DropItem(new Head(HeadType.Regular, this.Name, this.Serial, killr, DateTime.Now));
                            killr.SendAsciiMessage("As you kill them, you realize there is a bounty on their head! You take the head as evidence of your victory.");
                        }
                        BountyMark = false;
                    }
                }
            }

            if ( killer is BaseCreature )
            {
                BaseCreature bc = (BaseCreature)killer;

                Mobile master = bc.GetMaster();
                if( master != null )
                    killer = master;
            }

            if ( this.Young )
            {
                if ( YoungDeathTeleport() )
                    Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( SendYoungDeathNotice ) );
            }

            Faction.HandleDeath( this, killer );

            Server.Guilds.Guild.HandleDeath( this, killer );

            if( m_BuffTable != null )
            {
                List<BuffInfo> list = new List<BuffInfo>();

                foreach( BuffInfo buff in m_BuffTable.Values )
                {
                    if( !buff.RetainThroughDeath )
                    {
                        list.Add( buff );
                    }
                }

                for( int i = 0; i < list.Count; i++ )
                {
                    RemoveBuff( list[i] );
                }
            }

            ChatSystem system = null;

            if (RejoinChat)
            {
                foreach (Item item in World.Items.Values)
                {
                    if (item is ChatSystem)
                        system = item as ChatSystem;
                }

                if (system == null)
                    system = new ChatSystem();

                system.AddPlayer(this);

                if (JoinHidden)
                {
                    system.SetHidden(this);
                }
            }
        }
예제 #36
0
        public override bool OnBeforeDeath()
        {
            ChatSystem system = null;

            foreach (Item item in World.Items.Values)
            {
                if (item is ChatSystem)
                    system = item as ChatSystem;
            }

            if (system == null)
                system = new ChatSystem();

            RejoinChat = system.m_Players.ContainsKey(this);
            JoinHidden = false;

            if (RejoinChat)
            {
                system.m_Players.TryGetValue(this, out JoinHidden);
            }

            m_InsuranceCost = 0;
            m_InsuranceAward = base.FindMostRecentDamager( false );

            //Order Shield
            if (FindItemOnLayer(Layer.TwoHanded) is OrderShield)
            {
                FindItemOnLayer(Layer.TwoHanded).Delete();
            }
            if (Backpack != null && Backpack.FindItemByType(typeof(OrderShield)) != null)
            {
                Backpack.FindItemByType(typeof(OrderShield)).Delete();
            }

            //Chaos Shield
            if (FindItemOnLayer(Layer.TwoHanded) is ChaosShield)
            {
                FindItemOnLayer(Layer.TwoHanded).Delete();
            }
            if (Backpack != null && Backpack.FindItemByType(typeof(ChaosShield)) != null)
            {
                Backpack.FindItemByType(typeof(ChaosShield)).Delete();
            }

            if ( m_InsuranceAward is BaseCreature )
            {
                Mobile master = ((BaseCreature)m_InsuranceAward).GetMaster();

                if ( master != null )
                    m_InsuranceAward = master;
            }

            if ( m_InsuranceAward != null && (!m_InsuranceAward.Player || m_InsuranceAward == this) )
                m_InsuranceAward = null;

            if ( m_InsuranceAward is PlayerMobile )
                ((PlayerMobile)m_InsuranceAward).m_InsuranceBonus = 0;

            if ( m_ReceivedHonorContext != null )
                m_ReceivedHonorContext.OnTargetKilled();
            if ( m_SentHonorContext != null )
                m_SentHonorContext.OnSourceKilled();

            return base.OnBeforeDeath();
        }
예제 #37
0
파일: ChatGump.cs 프로젝트: Godkong/Origins
        public static void Chat_OnCommand(CommandEventArgs e)
        {
            Mobile caller = e.Mobile;
            ChatSystem system = null;
            string message = "";

            foreach (Item item in World.Items.Values.ToList())
            {
                if (item is ChatSystem)
                    system = item as ChatSystem;
            }

            if (system == null)
                system = new ChatSystem();

            if (e.Length >= 1)
            {
                foreach (string str in e.Arguments)
                {
                    message += str + " ";
                }

                if (!system.m_Players.ContainsKey(caller))
                {
                    caller.SendAsciiMessage("Usage: [chat");
                    return;
                }
                else
                {
                    foreach (Mobile m in system.m_Players.Keys.ToList())
                    {
                        m.SendAsciiMessage(0x49, String.Format("[{0}{1}]: {2}", (caller.AccessLevel > AccessLevel.Player ? "@" : ""), caller.Name, message));
                    }
                }
            }
            else
            {
                if (system.m_Players.ContainsKey(caller))
                {
                    caller.SendAsciiMessage("Usage: [chat <message>");
                    return;
                }
                else
                {
                    if (caller.HasGump(typeof(ChatGump)))
                        caller.CloseGump(typeof(ChatGump));

                    system.AddPlayer(caller);
                }
            }
        }
예제 #38
0
        private static void OnLogin( LoginEventArgs e )
        {
            Mobile from = e.Mobile;

            Region region = Region.Find(from.Location, from.Map);
            from.Send(PlayMusic.GetInstance(region.Music));

            CheckAtrophies( from );

            /*List<string> Tips = new List<string>();

            Tips.Add("There are no damage modifiers in this era (except the weapon skill itself). Anatomy, evaluating intelligence, lumberjacking, etc, do not add extra damage in combat.");
            Tips.Add("Meditation does not exist in PreT2A. Mana regenerates at a fixed rate for everyone. Armor does not affect regeneration rates, so someone wearing a full plate armor suit will regenerate mana as fast as someone without armor.");

            int count = 1;
            foreach (string message in Tips)
            {
                from.Send(new ScrollMessage(0x00, count, message));
                count++;
            }*/
            //char mynew = (char)0xA;

            //from.Send(new ScrollMessage(0x02, 1, "April 6, 2012 --- Hirelings now respond to the \"report\" command as well as \"work\", \"servant\", and \"mercenary\". NPC's have had their clothing updated to their proper Pre-T2A styles."));

            ChatSystem system = null;

            foreach (Item item in World.Items.Values)
            {
                if (item is ChatSystem)
                    system = item as ChatSystem;
            }

            if (system == null)
                system = new ChatSystem();

            system.AddPlayer(from);

            if (from.Player)
            {
                PlayerMobile pm = from as PlayerMobile;
                if (pm.HasMenu)
                {
                    pm.CantWalk = false;
                    pm.HasMenu = false;
                }
            }
            from.CantWalk = false;

            string[] BetaAccounts = new string[]
            {   "jeff",
                "whist",
                "roxxorshogun",
                "damond",
                "dweebothegeek",
                "Phoenix",
                "emceegyver",
                "slayer17",
                "rocky",
                "nitemare",
                "Terminus0",
                "iamnoah",
                "SirNike",
                "corvairkid",
                "nevdawg",
                "jed8168",
                "kirkweathers",
                "psychosis",
                "Greem Jelly",
                "speedstarrxx",
                "jani",
                "Milric",
                "marcus81184",
                "beefstew",
                "wyvern35",
                "Agaron",
                "fuk",
                "guillaume",
                "maverick69690",
                "blaimblame",
                "Dagothane",
                "dagros",
                "xebius",
                "engrave83",
                "321dropall",
                "irobot",
                "origins32123"
            };

            //300th Aniv
            /*if (from is PlayerMobile)
            {
                bool GiveAniv = true;
                Account myAccount = (Account)from.Account;

                ArrayList myAccounts = Server.Gumps.AdminGump.GetSharedAccounts(myAccount.LoginIPs);

                if (myAccount.GetTag("Aniv1") != null && myAccount.GetTag("Aniv1") == "true")
                {
                    GiveAniv = false;
                }
                else
                {
                    foreach (Account accnt in myAccounts)
                    {
                        if (accnt.GetTag("Aniv1") != null && accnt.GetTag("Aniv1") == "true")
                        {
                            GiveAniv = false;
                            break;
                        }
                    }
                }

                if (GiveAniv)
                {
                    Bag anivBag = new Bag();
                    anivBag.Name = "Happy 300th Anniversary!";
                    anivBag.Hue = Utility.RandomList(1419, 2121, 1275);

                    switch (Utility.RandomMinMax(0, 4))
                    {
                        case 0: anivBag.AddItem(new JaanasHangoverRemedy()); break;
                        case 1: anivBag.AddItem(new FireworksWand()); break;
                        case 2: anivBag.AddItem(new CommemorativeCoin()); break;
                        case 3: anivBag.AddItem(new CommemorativePlate()); break;
                        case 4: anivBag.AddItem(new MagicEightBall()); break;
                    }

                    if (from.Backpack != null && from.Alive)
                    {
                        from.Backpack.DropItem(anivBag);
                        myAccount.SetTag("Aniv1", "true");
                    }
                }
            }*/

            //Christmas
            /*if (from is PlayerMobile)
            {
                bool GiveAniv = true;
                Account myAccount = (Account)from.Account;

                if (true)// (myAccount.LastLogin.Day >= 25 && myAccount.LastLogin.Month == 12 && myAccount.LastLogin.Year == 2012)
                {
                    ArrayList myAccounts = Server.Gumps.AdminGump.GetSharedAccounts(myAccount.LoginIPs);

                    if (myAccount.GetTag("Christmas1") != null && myAccount.GetTag("Christmas1") == "true")
                    {
                        GiveAniv = false;
                    }
                    else
                    {
                        foreach (Account accnt in myAccounts)
                        {
                            if (accnt.GetTag("Christmas1") != null && accnt.GetTag("Christmas1") == "true")
                            {
                                GiveAniv = false;
                                break;
                            }
                        }
                    }

                    if (GiveAniv)
                    {
                        Server.Misc.ChristmasGifts.AddGifts(from);
                        myAccount.SetTag("Christmas1", "true");
                    }
                }
            }*/

            //2013 Christmas
            /*if (from is PlayerMobile)
            {
                bool GiveAniv = true;
                Account myAccount = (Account)from.Account;

                ArrayList myAccounts = new ArrayList(Server.Gumps.AdminGump.GetSharedAccounts(myAccount.LoginIPs));

                if (myAccount.GetTag("Christmas2013") != null && myAccount.GetTag("Christmas2013") == "true")
                {
                    GiveAniv = false;
                }
                else
                {
                    foreach (Account accnt in myAccounts)
                    {
                        if (accnt.GetTag("Christmas2013") != null && accnt.GetTag("Christmas2013") == "true")
                        {
                            GiveAniv = false;
                            break;
                        }
                    }
                }

                if (GiveAniv)
                {
                    if (from.Backpack != null && from.Alive)
                    {
                        from.Backpack.DropItem(new HolidayTicket(from as PlayerMobile) { LootType = LootType.Newbied });
                        myAccount.SetTag("Christmas2013", "true");
                    }
                }
            }*/

            //Beta reward
            if (from is PlayerMobile)
            {
                Account accoun = (Account)from.Account;
                String tag = accoun.GetTag("Beta");

                for (int i = 0; i < BetaAccounts.Length; ++i)
                {
                    if (tag == null || tag == "")
                    {
                        if (accoun.Username == BetaAccounts[i])
                            accoun.AddTag("Beta", "true");
                    }
                }

                tag = accoun.GetTag("Beta");

                if (tag == "true")
                {
                    if (from.Backpack != null)
                    {
                        Item item = new BetaCandle();

                        from.Backpack.DropItem(item);
                        from.SendAsciiMessage("For being a part of the Beta Phase, you have recieved a reward for your efforts.");
                        accoun.SetTag("Beta", "false");
                    }
                }
            }

            //Community Programme
            if (from is PlayerMobile)
            {
                Account myAccount = (Account)from.Account;
                if (myAccount != null)
                {
                    if (from.AccessLevel == AccessLevel.Player)
                    {
                        /*if (myAccount.Created >= DateTime.Now-TimeSpan.FromDays(1.0))
                            CompanionMessage(0x49, String.Format("[Companion] A NEW ACCOUNT has logged in. (Player: {0})", from.Name));
                        else if (myAccount.TotalGameTime <= TimeSpan.FromHours(20.0))
                            CompanionMessage(0x49, String.Format("[Companion] A NEW PLAYER has logged in: (Player: {0})", from.Name));
                        else if (DateTime.Now-myAccount.LastLogin >= TimeSpan.FromDays(30.0))
                            CompanionMessage(0x49, String.Format("[Companion] An INACTIVE PLAYER has logged in: (Player: {0})", from.Name));*/
                        if (myAccount.TotalGameTime <= TimeSpan.FromHours(20.0))
                            CompanionMessage(0x49, String.Format("[Companion Program] A new player has logged in. (Player: {0})", from.Name));
                    }
                }
            }

            if ( AccountHandler.LockdownLevel > AccessLevel.Player )
            {
                string notice;

                Accounting.Account acct = from.Account as Accounting.Account;

                if ( acct == null || !acct.HasAccess( from.NetState ) )
                {
                    if ( from.AccessLevel == AccessLevel.Player )
                        notice = "The server is currently under lockdown. No players are allowed to log in at this time.";
                    else
                        notice = "The server is currently under lockdown. You do not have sufficient access level to connect.";

                    Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Disconnect ), from );
                }
                else if ( from.AccessLevel >= AccessLevel.Administrator )
                {
                    notice = "The server is currently under lockdown. As you are an administrator, you may change this from the [Admin gump.";
                }
                else
                {
                    notice = "The server is currently under lockdown. You have sufficient access level to connect.";
                }

                from.SendGump( new NoticeGump( 1060637, 30720, notice, 0xFFC000, 300, 140, null, null ) );
                return;
            }

            //if( from is PlayerMobile )
            //	((PlayerMobile)from).ClaimAutoStabledPets();
        }