Ejemplo n.º 1
0
        private ElementType ConvertElementType(ElementStatus elementStatus)
        {
            switch (elementStatus)
            {
            case ElementStatus.Fire: return(ElementType.Fire);

            case ElementStatus.Water: return(ElementType.Water);

            case ElementStatus.Thunder: return(ElementType.Thunder);

            case ElementStatus.Ice: return(ElementType.Ice);

            case ElementStatus.Dragon: return(ElementType.Dragon);

            case ElementStatus.Poison: return(ElementType.Poison);

            case ElementStatus.Sleep: return(ElementType.Sleep);

            case ElementStatus.Paralysis: return(ElementType.Paralysis);

            case ElementStatus.Blast: return(ElementType.Blast);
            }

            throw new FormatException($"Unknown '{elementStatus}' element type.");
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the FxStatusChangeEventArgs class.
 /// </summary>
 /// <param name="newStatus"></param>
 /// <param name="oldStatus"></param>
 /// <param name="message"></param>
 public ElementStatusChangeEventArgs(ElementStatus oldStatus, ElementStatus newStatus, string message)
     : base((int)oldStatus, (int)newStatus, message)
 {
     Update = new ElementStatusUpdate();
     Update.NewStatus = newStatus;
     Update.OldStatus = oldStatus;
 }
Ejemplo n.º 3
0
    public override void ChangeStats(ELEMENTSTATS statistics, int value)
    {
        switch (statistics)
        {
        case ELEMENTSTATS.HEAL:
            playerData.currentPlayerHealt -= value;
            HitMe(value);
            if (playerData.currentPlayerHealt <= 0)
            {
                playerData.currentPlayerHealt = 0;
                this.status = ElementStatus.DEAD;
                IamDead();
            }
            break;

        case ELEMENTSTATS.SPEED:
            playerData.playerSpeed += value;
            break;

        case ELEMENTSTATS.ITEMSCOUNT:
            playerData.playerItemCount += value;
            RefreshGuears(this.playerData.playerItemCount);
            break;

        default:
            break;
        }
    }
 protected WeaponPrimitiveBase(
     WeaponType weaponType,
     uint id,
     ushort treeOrder,
     ushort baseModelId,
     ushort part1Id,
     ushort part2Id,
     byte color,
     byte treeId,
     FixedUpgradePrimitive isFixedUpgrade,
     uint craftingCost,
     byte rarity,
     ushort rawDamage,
     ushort defense,
     sbyte affinity,
     ElementStatus elementId,
     ushort elementDamage,
     ElementStatus hiddenElementId,
     ushort hiddenElementDamage,
     Elderseal elderseal,
     byte gemSlots,
     byte gemSlot1,
     byte gemSlot2,
     byte gemSlot3,
     byte treePosition,
     ushort sortOrder,
     ushort gmdNameIndex,
     ushort gmdDescriptionIndex,
     ushort skillId
     )
 {
     WeaponType          = weaponType;
     Id                  = id;
     TreeOrder           = treeOrder;
     BaseModelId         = baseModelId;
     Part1Id             = part1Id;
     Part2Id             = part2Id;
     Color               = color;
     TreeId              = treeId;
     IsFixedUpgrade      = isFixedUpgrade;
     CraftingCost        = craftingCost;
     Rarity              = rarity;
     RawDamage           = rawDamage;
     Defense             = defense;
     Affinity            = affinity;
     ElementId           = elementId;
     ElementDamage       = elementDamage;
     HiddenElementId     = hiddenElementId;
     HiddenElementDamage = hiddenElementDamage;
     Elderseal           = elderseal;
     GemSlots            = gemSlots;
     GemSlot1            = gemSlot1;
     GemSlot2            = gemSlot2;
     GemSlot3            = gemSlot3;
     TreePosition        = treePosition;
     SortOrder           = sortOrder;
     GmdNameIndex        = gmdNameIndex;
     GmdDescriptionIndex = gmdDescriptionIndex;
     SkillId             = skillId;
 }
Ejemplo n.º 5
0
        public ElementBuilder WithStatus(ElementStatus status)
        {
            if (status == ElementStatus.Deleted)
            {
                throw new ArgumentException("New element can't be deleted");
            }

            Status = status;
            return(this);
        }
Ejemplo n.º 6
0
        public WeaponElementViewModel(int damage, bool isHidden, ElementStatus elementStatus)
        {
            originalValue    = damage;
            originalIsHidden = isHidden;

            Type = ConvertElementType(elementStatus);

            Value    = originalValue;
            IsHidden = originalIsHidden;
        }
Ejemplo n.º 7
0
        public void UpdateStatusWithResultsFromUpstream_CallsCancelThenExec(PayLoadStatus statusFromUpstream, ElementStatus currentElementStatus, bool notify)
        {
            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.ExpectAndReturn(_el.Status, currentElementStatus).RepeatAlways(); ;
                _el.Cancel();
            }

            _el.UpdateStatusWithResultsFromUpstream(statusFromUpstream);
            MockManager.Verify();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Actually executes a swap.
        /// </summary>
        /// <param name="idx1"></param>
        /// <param name="idx2"></param>
        public void Swap(int idx1, int idx2)
        {
            ElementStatus temp_status = _status[idx1];

            _status[idx1] = _status[idx2];
            _status[idx2] = temp_status;

            T temp = _sequence[idx1];

            _sequence[idx1] = _sequence[idx2];
            _sequence[idx2] = temp;
        }
 private DualBladesSpecialPrimitive(
     ushort id,
     ElementStatus element1,
     ushort element1Damage,
     ElementStatus element2,
     ushort element2Damage
     )
 {
     Id             = id;
     Element1       = element1;
     Element1Damage = element1Damage;
     Element2       = element2;
     Element2Damage = element2Damage;
 }
Ejemplo n.º 10
0
        private string ReplyWithLastRanCampaign()
        {
            PeopleStageSystemSummary firstSystem     = apiClient.GetPeopleStageSystems()?.FirstOrDefault();
            List <ElementStatus>     campaigns       = apiClient.GetPeopleStageCampaigns(firstSystem);
            ElementStatus            lastRanCampaign = campaigns?.OrderByDescending(c => c.LastRan)?.FirstOrDefault();

            if (lastRanCampaign?.LastRan == null)
            {
                return("I don't know - I don't have any campaign information");
            }
            else
            {
                return(lastRanCampaign.Description + " last ran " + FormatDateForReply("on", lastRanCampaign.LastRan.Value));
            }
        }
Ejemplo n.º 11
0
        private static string GetBootstrapClassForIconTextAndStatus(ElementStatus status)
        {
            switch (status)
            {
            case ElementStatus.Disabled:
                return("text-muted");

            case ElementStatus.Active:
                return("text-white");

            case ElementStatus.Success:
                return("text-white");

            case ElementStatus.Warning:
                return("text-white");

            case ElementStatus.Danger:
                return("text-white");

            default:
                return("text-primary");
            }
        }
Ejemplo n.º 12
0
        private static string GetBootstrapClassForStatus(ElementStatus status)
        {
            switch (status)
            {
            case ElementStatus.Disabled:
                return("bg-dark");

            case ElementStatus.Active:
                return("bg-primary");

            case ElementStatus.Success:
                return("bg-success");

            case ElementStatus.Warning:
                return("bg-warning");

            case ElementStatus.Danger:
                return("bg-danger");

            default:
                return("");
            }
        }
Ejemplo n.º 13
0
        private static WeaponElementViewModel[] CreateElements(WeaponBase weapon)
        {
            var result = new List <WeaponElementViewModel>();

            if (weapon.ElementStatus != ElementStatus.None || weapon.HiddenElementStatus != ElementStatus.None)
            {
                int  value    = weapon.ElementStatusDamage > 0 ? weapon.ElementStatusDamage : weapon.HiddenElementStatusDamage;
                bool isHidden = weapon.HiddenElementStatusDamage > 0;

                ElementStatus elementStatus = weapon.ElementStatusDamage > 0 ? weapon.ElementStatus : weapon.HiddenElementStatus;

                result.Add(new WeaponElementViewModel(value, isHidden, elementStatus));

                if (weapon is DualBlades dualBlades && dualBlades.SecondaryElementStatus.HasValue)
                {
                    value         = dualBlades.SecondaryElementStatusDamage.Value;
                    elementStatus = dualBlades.SecondaryElementStatus.Value;

                    result.Add(new WeaponElementViewModel(value, false, elementStatus));
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 14
0
 public StatusAttribute(ElementStatus status)
 {
     this.Status = status;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// This method is called when an <see cref="IElement"/> which is in the workspace, has its
 /// <see cref="IElement.Status"/> updated.  This could affect the workspace's <see cref="IWorkSpace.WorkMode"/>
 /// or the <see cref="IWorkSpace.ExecMode"/>.
 /// </summary>
 /// <param name="element">The <see cref="IElement"/> for which the <see cref="ElementStatus"/> has changed.</param>
 /// <param name="status">The new status.</param>
 internal void UpdateWorkSpaceStatus(IElement element, ElementStatus status)
 {
     if (WorkMode == WorkSpaceMode.Execution)
     {
         // TODO need to implement logic here
     }
     else if (WorkMode == WorkSpaceMode.Connection)
     {
         throw new InvalidOperationException("Cant execute when in WorkSpace Connection mode");
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Moves to the next permutation.
        /// </summary>
        /// <returns></returns>
        public bool MoveNext()
        {
            // intialize if needed.
            if (_status == null)
            {
                // reset the status.
                _status    = new ElementStatus[_sequence.Length];
                _status[0] = new ElementStatus(1, null);
                for (uint idx = 1; idx < _sequence.Length; idx++)
                {
                    _status[idx] = new ElementStatus(idx + 1, false);
                }
                return(true);
            }

            int           max_idx = 0;
            ElementStatus max     = new ElementStatus(uint.MinValue, null);

            for (int idx = 0; idx < _status.Length; idx++)
            {
                if (max.Value < _status[idx].Value && _status[idx].Direction.HasValue)
                { // the new value is bigger!
                    max_idx = idx;
                    max     = _status[idx];
                }
            }

            // the algorithm is terminated if nothing is found.
            if (!max.Direction.HasValue)
            { // all directions are unmarked.
                return(false);
            }

            // execute the swap.
            int idx1 = max_idx;
            int idx2 = max.IsForward ? max_idx + 1 : max_idx - 1;

            this.Swap(idx1, idx2);

            // update status.
            if (idx2 > idx1 && idx2 < _status.Length - 1)
            {     // there is a next element, test if it is larger.
                if (_status[idx2 + 1].Value > max.Value)
                { // reset the direction of max.
                    max.Direction = null;
                }
            }
            else if (idx2 < idx1 && idx2 > 0)
            {     // there is a next element, test if it is larger.
                if (_status[idx2 - 1].Value > max.Value)
                { // reset the direction of max.
                    max.Direction = null;
                }
            }
            if (idx2 == 0 || idx2 == _status.Length - 1)
            { // reset the direction of that element
                _status[idx2].Direction = null;
            }
            for (int idx = 0; idx < _status.Length; idx++)
            {     // redirect all of the element higher than the selected element.
                if (_status[idx].Value > max.Value)
                { // reset the direction.
                    _status[idx].Direction = (idx < idx2);
                }
            }
            return(true);
        }
        public void SetStatus_DoesNotFiresEventWhenNoChange(ElementStatus oldStatus, ElementStatus newStatus, StatusChangeDriver driver, string mssg)
        {
            var mockInPortMgr = new Mock<IInputPortMgr>();

            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.ExpectAndReturn(_el.Status, oldStatus).RepeatAlways();
                _el.Status = newStatus;
                recorder.FailWhenCalled();
            }

            _el.SetStatus(newStatus, driver, mssg);
            MockManager.Verify();
        }
Ejemplo n.º 18
0
 public void SetStatus(ElementStatus status, StatusChangeDriver driver, string mssg)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 19
0
 public void SetElementStatus(ElementStatus parentStatus)
 {
     switch (parentStatus)
     {
         case ElementStatus.Incomplete:
             //_StatusPage.Image = BlueSpider.AppResources.Properties.Resources.ElStatus_Incomplete_16;
             _StatusPage.ImageIndex = 0;
             break;
         case ElementStatus.Validating:
             //_StatusPage.Image = BlueSpider.AppResources.Properties.Resources.ElStatus_Validating_16;
             _StatusPage.ImageIndex = 1;
             break;
         case ElementStatus.Executing:
             //_StatusPage.Image = BlueSpider.AppResources.Properties.Resources.ElStatus_Executing_16;
             _StatusPage.ImageIndex = 2;
             break;
         case ElementStatus.Complete:
             //_StatusPage.Image = BlueSpider.AppResources.Properties.Resources.ElStatus_Complete_16;
             _StatusPage.ImageIndex = 3;
             break;
         case ElementStatus.Error:
             // _StatusPage.Image = BlueSpider.AppResources.Properties.Resources.ElStatus_Error_16;
             _StatusPage.ImageIndex = 4;
             break;
         default:
             //_StatusPage.Image = null;
             _StatusPage.ImageIndex = -1;
             break;
     }
 }
Ejemplo n.º 20
0
        public Agent(String id, List<KVP> items, AgentDataDictionary iAgentDataDictionary,Dispatcher uiThread)
        {
            ID = id;
            _imageDictionary = iAgentDataDictionary;
            
            _name = iAgentDataDictionary.GetAgentNameByID(id);

            Items = Item.KvpToItems(items, iAgentDataDictionary, uiThread);

            int tsc = 0;
            Item tIt = null;
            foreach (var item in Items)
            {
                if (item.Key.StartsWith("account"))
                {
                    tsc = Int32.Parse(item.Amount);
                    tIt = item;
                    break;
                }
            }

            _account = tsc;

            _uiDispatcher = uiThread;
            _uiDispatcher.Invoke(() =>
            {
                _bg = new SolidColorBrush(Colors.LightYellow);
                _brd = new SolidColorBrush(ColorAndIconAssigner.GetOrAssignColorById(id));
                if (tIt!=null) Items.Remove(tIt);
            });

            st = ElementStatus.New;
        }
Ejemplo n.º 21
0
 /// <summary>
 /// This method should be used for all internal needs to set the status.
 /// </summary>
 /// <param name="status"></param>
 /// <param name="mssg">The string message which becomes part of the event arguments.</param>
 public void SetStatus(ElementStatus status, StatusChangeDriver driver, string mssg)
 {
     if (Status != status)
     {
         ElementStatus oldStatus = Status;
         Status = status;
         Message = mssg; var arg = new ElementStatusChangeEventArgs(oldStatus, Status, mssg);
         arg.InputPortStatuses = InPortMgr.PortStatuses;
         arg.OutputPortStatuses = OutPortMgr.PortStatuses;
         OnStatusChanged(arg);
     }
 }
        public void SetStatus_FiresStatusChangedEventIfNewStatusIsDifferent(ElementStatus oldStatus, ElementStatus newStatus, StatusChangeDriver driver, string mssg)
        {
            HelperForElements helper = new HelperForElements();
            _el.StatusChanged += new StatusChangeEventHandler<IElement, ElementStatusChangeEventArgs>(helper.StatusChanged_DummyHandler);

            var mockInPortMgr = new Mock<IInputPortMgr>();

            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.ExpectAndReturn(_el.Status, oldStatus).RepeatAlways();
                _el.Message = mssg;
                helper.StatusChanged_DummyHandler(null, null);
            }

            _el.SetStatus(newStatus, driver, mssg);
            MockManager.Verify();
        }
Ejemplo n.º 23
0
        public Item(String key, List<KVP> list, CfgSettings cfg, AgentDataDictionary ag, Dispatcher uiDispatcher): base(key, new List<KVP>())
        {
            cfgSettings = cfg;
            if (key.StartsWith("oblig"))
            {
               // InstanceOf = "obligation";
            }
            ImageDictionary = ag;
            UIDispatcher = uiDispatcher;
            Status = ElementStatus.Unchanged;
            
            foreach (var l in list)
            {
                if (l.Key.Equals("held_by"))
                {
                    StringAttributeList.Add("Held by", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    _held_by = l.Value;
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("owned_by"))
                {
                    StringAttributeList.Add("Owned by", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    _owned_by = l.Value;
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("instance_of"))
                {
                    StringAttributeList.Add("Instance of", l.Value);
                    InstanceOf = l.Value;
                }
                else if (l.Key.Equals("weight"))
                {
                    StringAttributeList.Add("Weight", l.Value);
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("status"))
                {
                    StringAttributeList.Add("Status", l.Value);
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("auctioneer"))
                {
                    StringAttributeList.Add("Auctioneer", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("highest_bidder"))
                {
                    StringAttributeList.Add("Highest bidder", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("last_bid_time"))
                {
                    StringAttributeList.Add("Last bid time", l.Value.Substring(0, 5));
                    ListOfItems.Remove(l);
                }
                else if (l.Key.IndexOf("_") > 0)
                {
                    String st = l.Key.Replace("_", " ");
                    st = st[0].ToString().ToUpper()[0] + st.Substring(1);
                    StringAttributeList.Add(st, l.Value);
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("item"))
                {
                    StringAttributeList.Add("Item", l.Value);
                    InstanceOf = l.Value;
                }
                
                else if (l.Type == ItemType.Attribute)
                {
                   // String st = l.Key[0].ToString().ToUpper()[0] + l.k.Substring(1);
                    StringAttributeList.Add(l.Key, l.Value);
                    ListOfItems.Remove(l);
                }
                else
                {
                    ListOfItems.Add(l);
                }
            }
            UIDispatcher.Invoke(() =>
            {
                BorderBrush = getBrush();
                BorderBrush2 = getHeldBrush();
            });
            

        }
Ejemplo n.º 24
0
 private MeleeWeaponPrimitiveBase(
     WeaponType weaponType,
     uint id,
     ushort treeOrder,
     ushort baseModelId,
     ushort part1Id,
     ushort part2Id,
     byte color,
     byte treeId,
     FixedUpgradePrimitive isFixedUpgrade,
     uint craftingCost,
     byte rarity,
     byte sharpnessId,
     byte handicraft,
     ushort rawDamage,
     ushort defense,
     sbyte affinity,
     ElementStatus elementId,
     ushort elementDamage,
     ElementStatus hiddenElementId,
     ushort hiddenElementDamage,
     Elderseal elderseal,
     byte gemSlots,
     byte gemSlot1,
     byte gemSlot2,
     byte gemSlot3,
     ushort weapon1Id,
     ushort weapon2Id,
     byte treePosition,
     ushort sortOrder,
     ushort gmdNameIndex,
     ushort gmdDescriptionIndex,
     ushort skillId
     )
     : base(
         weaponType,
         id,
         treeOrder,
         baseModelId,
         part1Id,
         part2Id,
         color,
         treeId,
         isFixedUpgrade,
         craftingCost,
         rarity,
         rawDamage,
         defense,
         affinity,
         elementId,
         elementDamage,
         hiddenElementId,
         hiddenElementDamage,
         elderseal,
         gemSlots,
         gemSlot1,
         gemSlot2,
         gemSlot3,
         treePosition,
         sortOrder,
         gmdNameIndex,
         gmdDescriptionIndex,
         skillId
         )
 {
     SharpnessId = sharpnessId;
     Handicraft  = handicraft;
     Weapon1Id   = weapon1Id;
     Weapon2Id   = weapon2Id;
 }
        public readonly byte SpecialAmmoId;                 // LBG and HBG: 0: Wyvernblast, 1: Wyvernfire, 2: Wyvernsnipe. Bow: reference to common/equip/bottle_table.bbtbl

        private RangeWeaponPrimitiveBase(
            WeaponType weaponType,
            uint id,
            ushort treeOrder,
            ushort baseModelId,
            ushort part1Id,
            ushort part2Id,
            byte color,
            byte treeId,
            FixedUpgradePrimitive isFixedUpgrade,
            MuzzelTypePrimitive muzzelType,
            BarrelTypePrimitive barrelType,
            MagazineTypePrimitive magazineType,
            ScopeTypePrimitive scopeType,
            uint craftingCost,
            byte rarity,
            ushort rawDamage,
            ushort defense,
            sbyte affinity,
            ElementStatus elementId,
            ushort elementDamage,
            ElementStatus hiddenElementId,
            ushort hiddenElementDamage,
            Elderseal elderseal,
            ushort shellTableId,
            BowgunDeviation deviation,
            byte gemSlots,
            byte gemSlot1,
            byte gemSlot2,
            byte gemSlot3,
            byte specialAmmoId,
            byte treePosition,
            ushort sortOrder,
            ushort gmdNameIndex,
            ushort gmdDescriptionIndex,
            ushort skillId
            )
            : base(
                weaponType,
                id,
                treeOrder,
                baseModelId,
                part1Id,
                part2Id,
                color,
                treeId,
                isFixedUpgrade,
                craftingCost,
                rarity,
                rawDamage,
                defense,
                affinity,
                elementId,
                elementDamage,
                hiddenElementId,
                hiddenElementDamage,
                elderseal,
                gemSlots,
                gemSlot1,
                gemSlot2,
                gemSlot3,
                treePosition,
                sortOrder,
                gmdNameIndex,
                gmdDescriptionIndex,
                skillId
                )
        {
            MuzzelType    = muzzelType;
            BarrelType    = barrelType;
            MagazineType  = magazineType;
            ScopeType     = scopeType;
            ShellTableId  = shellTableId;
            Deviation     = deviation;
            SpecialAmmoId = specialAmmoId;
        }