예제 #1
0
        // This method is used to prepare sets of x-columns in the format expected by the multivariate fitting routines.

        private static void PrepareColumns(
            IReadOnlyList <IReadOnlyList <double> > xColumns, int expectedLength,
            out List <IReadOnlyList <double> > xColumnsCopy, out List <string> xNames)
        {
            Debug.Assert(xColumns != null);

            xNames       = new List <string>();
            xColumnsCopy = new List <IReadOnlyList <double> >();
            foreach (IReadOnlyList <double> xColumn in xColumns)
            {
                if (xColumn == null)
                {
                    throw new ArgumentNullException(nameof(xColumns));
                }
                if (xColumn.Count != expectedLength)
                {
                    throw new DimensionMismatchException();
                }
                INamed named = xColumn as INamed;
                if (named == null)
                {
                    xNames.Add(xNames.Count.ToString());
                }
                else
                {
                    xNames.Add(named.Name);
                }
                xColumnsCopy.Add(xColumn);
            }
            xNames.Add("Intercept");
            xColumnsCopy.Add(null);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MTSSystem = new RtSystem();

                MTSSystem.Connect("", "AppName", "Appname");

                IObjectCollection Names = MTSSystem.StationNames;

                foreach (var key in Names)
                {
                    INamed N = (INamed)key;

                    comboBox1.Items.Add(N.KeyName);
                }

                comboBox1.SelectedIndex = 0;

                string name = comboBox1.Items[0].ToString();

                Debug.WriteLine("Station name is: " + name);

                Station = MTSSystem.FindStation(name, "AppName", "", oEnumAppType.oAppSummary);

                Debug.WriteLine(Station.Channels.Count);
            }
            catch (Exception err)
            {
                MessageBox.Show("DANGER WILL ROBINSON--" + err.ToString());
            }
        }
예제 #3
0
 GetNotificationContentFactories <T>(INamed action, CommandType commandType)
 {
     if (action is ThenAction <T> thenAction)
     {
         return
             (
             date => new BeforeThenNotificationContent <T>(date, thenAction.Question),
             time => new AfterThenNotificationContent(time, ThenOutcome.Pass),
             (error, duration) => new AfterThenNotificationContent(duration, GetOutcome(error), error)
             );
     }
     if (action is CommandAction <T> commandAction)
     {
         return
             (
             date => new BeforeFirstActionNotificationContent(date, commandAction.ActionContext),
             time => new AfterActionNotificationContent(time),
             (error, duration) => new ExecutionErrorNotificationContent(error, duration)
             );
     }
     return
         (
         date => new BeforeActionNotificationContent(date, commandType),
         time => new AfterActionNotificationContent(time),
         (error, duration) => new ExecutionErrorNotificationContent(error, duration)
         );
 }
예제 #4
0
파일: NamedList.cs 프로젝트: radtek/datawf
 public void Set(INamed value)
 {
     if (value != null)
     {
         this[value.Name] = (T)value;
     }
 }
예제 #5
0
        public static void HandleTextEmote(IRealmClient client, RealmPacketIn packet)
        {
            Character activeCharacter = client.ActiveCharacter;

            if (!activeCharacter.CanMove || !activeCharacter.CanInteract)
            {
                return;
            }
            TextEmote emote1 = (TextEmote)packet.ReadUInt32();

            packet.SkipBytes(4);
            EntityId id     = packet.ReadEntityId();
            INamed   target = activeCharacter.Map.GetObject(id);

            if (target != null)
            {
                SendTextEmote(activeCharacter, emote1, target);
            }
            EmoteType emote2;

            EmoteDBC.EmoteRelationReader.Entries.TryGetValue((int)emote1, out emote2);
            switch (emote2)
            {
            case EmoteType.StateDance:
            case EmoteType.StateSleep:
            case EmoteType.StateSit:
            case EmoteType.StateKneel:
                activeCharacter.EmoteState = emote2;
                break;

            default:
                activeCharacter.Emote(emote2);
                break;
            }
        }
예제 #6
0
#pragma warning restore

        public MapperTreeNode(ModelMapper mapper)
            : base()
        {
            Mapper = mapper;

            FNamed = mapper.Map <INamed>();

            Text            = FNamed.Name;
            Tag             = mapper.Model;
            FNamed.Renamed += Item_Renamed;

            if (mapper.CanMap <IParent>())
            {
                var items = mapper.Map <IParent>();
                if (items.Childs != null)
                {
                    // Keep Nodes and items in sync
                    FSynchronizer         = Nodes.SyncWith(items.Childs, CreateChildNode);
                    FSynchronizer.Synced += synchronizer_Synced;
                }
            }
            if (mapper.CanMap <ISelectable>())
            {
                FSelectable = mapper.Map <ISelectable>();
                Checked     = FSelectable.Selected;
                FSelectable.SelectionChanged += Item_SelectionChanged;
            }
        }
예제 #7
0
        public IType checkAssignMember(Context context, String memberName, IType valueType)
        {
            INamed actual = context.getRegisteredValue <INamed>(name);

            if (actual == null)
            {
                throw new SyntaxError("Unknown variable:" + this.name);
            }
            IType thisType = actual.GetIType(context);

            if (thisType is DocumentType)
            {
                return(valueType);
            }
            else
            {
                if (thisType is CategoryType && !((CategoryType)thisType).Mutable)
                {
                    throw new SyntaxError("Not mutable:" + this.name);
                }
                IType requiredType = thisType.checkMember(context, memberName);
                if (requiredType != null && !requiredType.isAssignableFrom(context, valueType))
                {
                    throw new SyntaxError("Incompatible types:" + requiredType.GetTypeName() + " and " + valueType.GetTypeName());
                }
                return(valueType);
            }
        }
예제 #8
0
 private TResult ExecuteNotifyingAction <TResult>(
     Func <bool> canNotify,
     Func <TResult> executeAction,
     INamed action,
     CommandType commandType)
 {
     if (!canNotify())
     {
         return(executeAction());
     }
     _depth++;
     var(createBefore, createAfter, createError) = GetNotificationContentFactories <TResult>(action, commandType);
     Observer.OnNext(new ActionNotification(action, _depth, createBefore(MeasureTime.Now)));
     var(duration, result, exception) = MeasureTime.Measure(executeAction);
     if (exception == null)
     {
         Observer.OnNext(new ActionNotification(action, _depth, createAfter(duration)));
         _depth--;
         return(result);
     }
     else
     {
         Observer.OnNext(new ActionNotification(action, _depth, createError(exception, duration)));
         _depth--;
         throw exception;
     }
 }
예제 #9
0
 public Context downcast(Context context, bool setValue)
 {
     if (oper == EqOp.IS_A)
     {
         String name = readLeftName();
         if (name != null)
         {
             INamed value      = context.getRegisteredValue <INamed>(name);
             IType  targetType = ((TypeExpression)right).getType().Resolve(context);
             IType  sourceType = value.GetIType(context);
             if (sourceType.IsMutable(context))
             {
                 targetType = targetType.AsMutable(context, true);
             }
             Context local = context.newChildContext();
             value = new LinkedVariable(targetType, value);
             local.registerValue(value, false);
             if (setValue)
             {
                 local.setValue(name, new LinkedValue(context, targetType));
             }
             context = local;
         }
     }
     return(context);
 }
예제 #10
0
        /// <summary>
        /// Distributes the given amount of XP over the group of the given Character (or adds it only to the Char, if not in Group).
        /// </summary>
        /// <remarks>Requires Map-Context.</remarks>
        /// <param name="chr"></param>
        public static void DistributeCombatXp(Character chr, INamed killed, int xp)
        {
            var groupMember = chr.GroupMember;

            if (groupMember != null)
            {
                var members      = new List <Character>();
                var highestLevel = 0;
                var totalLevels  = 0;
                groupMember.IterateMembersInRange(WorldObject.BroadcastRange,
                                                  member => {
                    var memberChar = member.Character;
                    if (memberChar != null)
                    {
                        totalLevels += memberChar.Level;
                        if (memberChar.Level > highestLevel)
                        {
                            highestLevel = memberChar.Level;
                        }
                        members.Add(memberChar);
                    }
                });

                foreach (var member in members)
                {
                    var share = MathUtil.Divide(xp * member.Level, totalLevels);
                    member.GainCombatXp(share, killed, true);
                }
            }
            else
            {
                chr.GainCombatXp(xp, killed, true);
            }
        }
예제 #11
0
        void FProject_ItemRenamed(INamed sender, string newName)
        {
            var doc    = sender as IDocument;
            var folder = GetOrCreateFolder(doc.GetRelativeDir());

            folder.Documents.UpdateKey(doc.Name, newName);
        }
예제 #12
0
        public IType check(Context context)
        {
            IType type = expression.check(context);

            if (type != TupleType.Instance)
            {
                throw new SyntaxError("Expecting a tuple expression, got " + type.GetTypeName());
            }
            foreach (String name in names)
            {
                INamed actual = context.getRegistered(name);
                if (actual == null)
                {
                    IType actualType = expression.check(context);
                    context.registerValue(new Variable(name, actualType));
                }
                else
                {
                    // need to check type compatibility
                    IType actualType = actual.GetIType(context);
                    IType newType    = expression.check(context);
                    actualType.checkAssignableFrom(context, newType);
                }
            }
            return(VoidType.Instance);
        }
예제 #13
0
 /// <summary>
 /// ValueRow source with dynamic name
 /// </summary>
 /// <param name="guid"></param>
 /// <param name="named"></param>
 /// <param name="vr"></param>
 /// <param name="owner"></param>
 public ValueRowSource(string guid, INamed named, ValueRow vr, object owner)
 {
     _guid     = guid;
     _named    = named;
     _valueRow = vr;
     _owner    = owner;
 }
예제 #14
0
        public DefaultNameProvider(ModelMapper mapper)
        {
            var model = mapper.Model;

            // best option to provide a name is to be able to look it up on the model through interface INamed
            FNamedModel = model as INamed;
            if (FNamedModel != null)
            {
                Name = FNamedModel.Name;
                FNamedModel.Renamed += DefaultNameProvider_Renamed;
            }
            else
            {
                bool resolved = false;

                if (model is IIDItem)
                {
                    var parent = ((IIDItem)model).Owner;

                    // Find my name through property of the parent model object if accesible
                    if (parent != null)
                    {
                        Name = PropertyName(parent, model, ref resolved);
                    }
                }

                if (!resolved)
                {
                    // default .NET string representation of the model object
                    Name = model.ToString();
                }
            }
        }
예제 #15
0
        public override INamed getRegistered(string name)
        {
            if (widgetFields != null)
            {
                WidgetField field = null;
                if (widgetFields.TryGetValue(name, out field))
                {
                    return(field);
                }
            }
            INamed actual = base.getRegistered(name);

            if (actual != null)
            {
                return(actual);
            }
            ConcreteCategoryDeclaration decl    = getDeclaration();
            MethodDeclarationMap        methods = decl.getMemberMethods(this, name);

            if (methods != null && methods.Count > 0)
            {
                return(methods);
            }
            else if (decl.hasAttribute(this, name))
            {
                return(getRegisteredDeclaration <AttributeDeclaration>(name));
            }
            else
            {
                return(null);
            }
        }
    /// <summary>
    /// Attempts to create a string representation of a string which is both sufficiently
    /// helpful but not overly verbose. Use the .Name if provided.
    /// </summary>
    /// <param name="named"></param>
    /// <returns></returns>
    public static string ToString(INamed named)
    {
        if (!string.IsNullOrEmpty(named.Name))
        {
            return($"<{named.Name}>");
        }

        if (named is IParser parser)
        {
            var pType     = parser.GetType();
            var pTypeName = pType.Name;
            if (pType.DeclaringType != null)
            {
                if (pTypeName == "Parser" || pTypeName == "SingleParser" || pTypeName == "MultiParser")
                {
                    return($"<{pType.DeclaringType.Name} Id={parser.Id}>");
                }

                return($"<{pType.DeclaringType.Name}.{pType.Name} Id={parser.Id}>");
            }

            return($"<{pType.Name} Id={parser.Id}>");
        }

        var objType = named.GetType();

        if (objType.DeclaringType != null)
        {
            return($"<{objType.DeclaringType.Name}.{objType.Name}>");
        }

        return($"<objType.Name>");
    }
예제 #17
0
파일: ChartForm.cs 프로젝트: fdafadf/main
        public ChartForm(string title, IEnumerable <SimulationResults> results)
        {
            InitializeComponent();
            base.Text  = title;
            TabControl = new TabControl();
            TabControl.SuspendLayout();
            TabControl.Location      = new Point(529, 234);
            TabControl.Name          = "tabControl";
            TabControl.SelectedIndex = 0;
            TabControl.Size          = new Size(200, 100);
            TabControl.TabIndex      = 1;
            TabControl.Dock          = DockStyle.Fill;

            foreach (var resultsItem in results)
            {
                INamed namedItem = resultsItem;

                foreach (var serie in resultsItem.Series)
                {
                    EnsureChart(EnsureTabPage(serie.Key)).AddSeries(namedItem.Name, serie.Value);
                }
            }

            Controls.Add(TabControl);
            TabControl.ResumeLayout(false);
        }
예제 #18
0
        /// <summary>
        /// Reports that the given actor has gained the given ability.
        /// </summary>
        /// <param name="actor">Actor.</param>
        /// <param name="ability">Ability.</param>
        /// <param name="scenarioId">The screenplay scenario identity.</param>
        public void GainAbility(INamed actor, IAbility ability,
                                Guid scenarioId)
        {
            var scenario = GetScenarioBuilder(scenarioId);

            scenario.GainAbility(actor, ability);
        }
예제 #19
0
 protected virtual void OnItemRenamed(INamed item, string newName)
 {
     if (ItemRenamed != null)
     {
         ItemRenamed(item, newName);
     }
 }
예제 #20
0
 public bool Equals(INamed other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Name.Equals(other.Name));
 }
예제 #21
0
파일: NamedList.cs 프로젝트: radtek/datawf
 public void Set(INamed value, int index)
 {
     if (value != null)
     {
         Set(value);
         this[index] = (T)value;
     }
 }
예제 #22
0
        public static Property Create(INamed parentContainer, params string[] names)
        {
            SymbolicName requiredSymbolicName = ExtractRequiredSymbolicName(parentContainer);

            return(new Property(parentContainer,
                                requiredSymbolicName,
                                CreateListOfChainedNames(names)));
        }
예제 #23
0
 /// <summary>
 /// Creates a new instance of <see cref="ActionNotification"/>
 /// </summary>
 /// <param name="action"></param>
 /// <param name="depth"></param>
 /// <param name="content"></param>
 public ActionNotification(INamed action, int depth, IActionNotificationContent content)
 {
     Guard.ForNull(action, nameof(action));
     Guard.ForNull(content, nameof(content));
     Action  = action;
     Depth   = depth;
     Content = content;
 }
예제 #24
0
        string IProvidesReport.GetReport(INamed actor)
        {
            if (actor == null)
            {
                throw new ArgumentNullException(nameof(actor));
            }

            return(GetReport(actor));
        }
예제 #25
0
        public ExecuteCommandRename(IActivateItems activator, INamed nameable) : base(activator)
        {
            _nameable = nameable;

            if (nameable is ITableInfo)
            {
                SetImpossible("TableInfos cannot not be renamed");
            }
        }
예제 #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CSF.Screenplay.Reporting.Trace.ActorReport"/> class.
        /// </summary>
        /// <param name="actor">Actor.</param>
        public ActorReport(INamed actor)
        {
            if (actor == null)
            {
                throw new ArgumentNullException(nameof(actor));
            }

            Actor = actor;
        }
        // ReSharper restore UnusedParameter.Local
        // ReSharper disable UnusedParameter.Local
        void TestNamed(INamed instance, string name = "Name")
        {
            string propName = null;
            instance.PropertyChanged += (_, n) => propName = n.PropertyName;

            instance.Name = "1";
            Assert.Equal("1", instance.Name);
            Assert.Equal(name, propName);
        }
예제 #28
0
 public static void SendWinner(DuelWin win, Unit winner, INamed loser)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_WINNER))
     {
         packet.Write((byte)win);
         packet.Write(winner.Name);
         packet.Write(loser.Name);
         winner.SendPacketToArea(packet, true, true, Locale.Any, new float?());
     }
 }
예제 #29
0
        public override void register(Context context)
        {
            INamed actual = context.getRegisteredValue <INamed>(name);

            if (actual != null)
            {
                throw new SyntaxError("Duplicate argument: \"" + name + "\"");
            }
            context.registerValue(this);
        }
예제 #30
0
        public void registerDeclaration(IDeclaration declaration)
        {
            INamed actual = getRegistered(declaration.GetName());

            if (actual != null && actual != declaration)
            {
                throw new SyntaxError("Duplicate name: \"" + declaration.GetName() + "\"");
            }
            declarations[declaration.GetName()] = declaration;
        }
예제 #31
0
		public static void SendWinner(DuelWin win, Unit winner, INamed loser)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_WINNER))
			{
				packet.Write((byte)win);
				packet.Write(winner.Name);
				packet.Write(loser.Name);

				winner.SendPacketToArea(packet);
			}
		}
예제 #32
0
 /// <summary>
 /// Validates the name if required
 /// </summary>
 /// <param name="named"></param>
 public static void NameIsRequired(this INamed named, string message = null)
 {
     if (string.IsNullOrWhiteSpace(named.Name))
     {
         throw new System.InvalidOperationException(
                   string.IsNullOrWhiteSpace(message) ?
                   "Name is required" :
                   message
                   );
     }
 }
예제 #33
0
        public RenameMemberCommand(
            INamed namedObject,
            IValidateNameService validateNameService,
            MessageSystem messageSystem)
        {
            _namedObject = namedObject;
            Requires(validateNameService != null);
            Requires(messageSystem != null);

            _validateNameService = validateNameService;
            _messageSystem = messageSystem;
        }
예제 #34
0
        // Client doesn't seem to be sending this
        //[ClientPacketHandler(RealmServerOpCode.CMSG_EMOTE)]
        //public static void HandleEmote(IRealmClient client, RealmPacketIn packet)
        //{
        //    var emote = (EmoteType)packet.ReadUInt32();

        //    if (emote != EmoteType.None)
        //    {
        //        var chr = client.ActiveCharacter;
        //        if (chr.CanMove && chr.CanInteract)
        //        {
        //            SendEmote(chr, emote);
        //        }
        //    }
        //}

        public static void SendTextEmote(WorldObject obj, TextEmote emote, INamed target)
        {
            var len = (target == null) ? 20 : target.Name.Length + 21;

            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TEXT_EMOTE, len))
            {
                packet.Write(obj.EntityId);
                packet.WriteUInt((uint)emote);
                packet.WriteInt(-1);
                packet.WriteUIntPascalString(target != null ? target.Name : "");

                obj.SendPacketToArea(packet, true);
            }
        }
	public bool IsClicked()
	{
		if(! HasButtons)
			return false;

		for(int i = 0; i < _gridButtons.Count; i++)
		{
			AsvarduilButton button = _gridButtons[i];
			if(button.IsClicked())
			{
				SelectedObject = DataElements[i];
				return true;
			}
		}

		return false;
	}
예제 #36
0
파일: Unit.cs 프로젝트: ray2006/WCell
		/// <summary>
		/// Makes this Unit do a text emote
		/// </summary>
		/// <param name="emote">Anything that has a name (to do something with) or null</param>
		public void TextEmote(TextEmote emote, INamed target)
		{
			EmoteHandler.SendTextEmote(this, emote, target);
		}
예제 #37
0
        /// <summary>
        /// Sends experience gained notifications to the character
        /// OPCODE: SMS_LOG_XPGAIN
        /// </summary>
        /// <param name="client">the client to send to</param>
        /// <param name="xpReceived">the amout of experience gained</param>
        /// <param name="victim">the xp resource, NPC if the experience is gained through combat, otherwise null (quests etc.)</param>
        /// <param name="xpRestBonus">the rest bonus experience amount (default 0)</param>
        public static void SendXpReceivedNotification(IPacketReceiver client, int xpReceived, INamed victim = null, int xpRestBonus = 0)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOG_XPGAIN))
            {
                var xpSourceEntity = victim as NPC;

                packet.Write(xpSourceEntity != null ? xpSourceEntity.EntityId : EntityId.Zero);
                packet.Write(xpReceived + xpRestBonus);
                packet.WriteByte(xpSourceEntity != null ? 0 : 1);

                if (xpSourceEntity != null)
                {
                    packet.Write(xpReceived);
                    packet.WriteFloat(1);
                }

                packet.WriteByte(0);

                client.Send(packet);
            }
        }
예제 #38
0
		/// <summary>
		/// Broadcasts a kick message and then kicks this Character after the default delay.
		/// Requires map context.
		/// </summary>
		public void Kick(INamed kicker, string reason, int delay)
		{
			var other = (kicker != null ? " by " + kicker.Name : "") +
				(!string.IsNullOrEmpty(reason) ? " (" + reason + ")" : ".");
			World.Broadcast("{0} has been kicked{1}", Name, other);

			SendSystemMessage("You have been kicked" + other);

			CancelTaxiFlight();
			Logout(true, delay);
		}
예제 #39
0
		/// <summary>
		/// Distributes the given amount of XP over the group of the given Character (or adds it only to the Char, if not in Group).
		/// </summary>
		/// <remarks>Requires Region-Context.</remarks>
		/// <param name="chr"></param>
		public static void DistributeCombatXp(Character chr, INamed killed, int xp)
		{
			var groupMember = chr.GroupMember;
			if (groupMember != null)
			{
				var members = new List<Character>();
				var highestLevel = 0;
				var totalLevels = 0;
				groupMember.IterateMembersInRange(WorldObject.BroadcastRange,
					member => {
						var memberChar = member.Character;
						if (memberChar != null)
						{
							totalLevels += memberChar.Level;
							if (memberChar.Level > highestLevel)
							{
								highestLevel = memberChar.Level;
							}
							members.Add(memberChar);
						}
					});

				foreach (var member in members)
				{
					var share = MathUtil.Divide(xp * member.Level, totalLevels);
					member.GainCombatXp(share, killed, true);
				}
			}
			else
			{
				chr.GainCombatXp(xp, killed, true);
			}
		}
예제 #40
0
		/// <summary>
		/// Gain experience from combat
		/// </summary>
		public void GainCombatXp(int experience, INamed killed, bool gainRest)
		{
			if (Level >= MaxLevel)
			{
				return;
			}

			var xp = experience + (experience * KillExperienceGainModifierPercent / 100);

			if (m_activePet != null && m_activePet.MayGainExperience)
			{
				// give xp to pet
				m_activePet.PetExperience += xp;
				m_activePet.TryLevelUp();
			}

			if (gainRest && RestXp > 0)
			{
				// add rest bonus
				var bonus = Math.Min(RestXp, experience);
				xp += bonus;
				RestXp -= bonus;
				ChatMgr.SendCombatLogExperienceMessage(this, Locale, RealmLangKey.LogCombatExpRested, killed.Name, experience, bonus);
			}
			else
			{
				ChatMgr.SendCombatLogExperienceMessage(this, Locale, RealmLangKey.LogCombatExp, killed.Name, experience);
			}

			Experience += xp;
			TryLevelUp();
		}
예제 #41
0
파일: Character.cs 프로젝트: Zakkgard/WCell
        /// <summary>
        /// Gain experience from combat
        /// </summary>
        public void GainCombatXp(int experience, INamed killed, bool gainRest)
        {
            if (this.Level >= this.MaxLevel)
            {
                return;
            }

            var xp = experience + (experience * this.KillExperienceGainModifierPercent / 100);

            if (m_activePet != null && m_activePet.MayGainExperience)
            {
                // give xp to pet
                m_activePet.PetExperience += xp;
                m_activePet.TryLevelUp();
            }

            if (gainRest && this.RestXp > 0)
            {
                // add rest bonus
                var bonus = Math.Min(this.RestXp, experience);
                xp += bonus;
                this.RestXp -= bonus;
                CharacterHandler.SendXpReceivedNotification(this, experience, killed, bonus);
            }
            else
            {
                CharacterHandler.SendXpReceivedNotification(this, experience, killed);
            }

            this.Experience += xp;
            this.TryLevelUp();
        }
예제 #42
0
파일: Character.cs 프로젝트: Skizot/WCell
		public void GainCombatXp(int experience, INamed killed, bool gainRest)
		{
			if (Level >= RealmServerConfiguration.MaxCharacterLevel)
			{
				return;
			}

			// Generate the message to send
			var message = string.Format("{0} dies, you gain {1} experience.", killed.Name, experience);

			XP += experience;
			if (gainRest && RestXp > 0)
			{
				var bonus = Math.Min(RestXp, experience);
				message += string.Format(" (+{0} exp Rested bonus)", bonus);
				XP += bonus;
				RestXp -= bonus;
			}

			// Send the message
			ChatMgr.SendCombatLogExperienceMessage(this, message);
			TryLevelUp();
		}
예제 #43
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="originLine">The line where cars are being removed</param>
 /// <param name="destinationLine">The line where cars are being added</param>
 /// <param name="cars">The given cars</param>
 public Movement(INamed originLine, INamed destinationLine, IEnumerable<INamed> cars)
 {
     OriginLine = originLine;
     DestinationLine = destinationLine;
     Cars = cars;
 }