상속: MonoBehaviour
예제 #1
0
    void AssignAttributes(Equipment e)
    {
        // Get base stat from equipment designation
        //foreach (KeyValuePair<string, StatTemplate> pair in e.Designation.BaseStats) {
        //  var statKey = pair.Key;
        //  var statTemplate = pair.Value;

        //  float val = BaseStatValue(statKey);

        //  float eqTypeMultiplier = EquipmentTypeMultiplier(e.Type, statKey);
        //  val *= eqTypeMultiplier;

        //  float rarityMultiplier = RarityMultiplier(e.Rarity, Stat.SignForValue(val));
        //  val *= rarityMultiplier;

        //  // Prefix
        //  var prefixRoll = tpd.RollPercent(e.Rarity.prefixChance);
        //  if (prefixRoll) {
        //    e.Prefix = EquipmentModifier.Prefix();
        //    ApplyModifier(e, e.Prefix);
        //  }

        //  // Suffix
        //  var suffixRoll = tpd.RollPercent(e.Rarity.suffixChance);
        //  if (suffixRoll) {
        //    e.Suffix = EquipmentModifier.Suffix();
        //    ApplyModifier(e, e.Suffix);
        //  }

        //  e.Stats[statTemplate.key] = new Stat(statTemplate.key, val);
        //}
    }
예제 #2
0
 ///<summary>Inserts one Equipment into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(Equipment equipment,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         equipment.EquipmentNum=ReplicationServers.GetKey("equipment","EquipmentNum");
     }
     string command="INSERT INTO equipment (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="EquipmentNum,";
     }
     command+="Description,SerialNumber,ModelYear,DatePurchased,DateSold,PurchaseCost,MarketValue,Location,DateEntry) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(equipment.EquipmentNum)+",";
     }
     command+=
          "'"+POut.String(equipment.Description)+"',"
         +"'"+POut.String(equipment.SerialNumber)+"',"
         +"'"+POut.String(equipment.ModelYear)+"',"
         +    POut.Date  (equipment.DatePurchased)+","
         +    POut.Date  (equipment.DateSold)+","
         +"'"+POut.Double(equipment.PurchaseCost)+"',"
         +"'"+POut.Double(equipment.MarketValue)+"',"
         +"'"+POut.String(equipment.Location)+"',"
         +    POut.Date  (equipment.DateEntry)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         equipment.EquipmentNum=Db.NonQ(command,true);
     }
     return equipment.EquipmentNum;
 }
        private void CreateInitialData()
        {
            _rootEquipment = new Equipment {Name = "Motor"};
            _childEquipment1 = new Equipment {Name = "AC Motor"};
            _childEquipment2 = new Equipment {Name = "DC Motor"};
            _grandCildEquipment1_1 = new Equipment {Name = "AC LV Motor"};
            _grandCildEquipment1_2 = new Equipment {Name = "AC MV Motor"};
            _grandCildEquipment1_3 = new Equipment {Name = "AC HV Motor"};
            _grandCildEquipment2_1 = new Equipment {Name = "DC LV Motor"};
            _grandCildEquipment2_2 = new Equipment {Name = "DC MV Motor"};

            _rootEquipment.AddChildEquipment(_childEquipment1);
            _rootEquipment.AddChildEquipment(_childEquipment2);
            _childEquipment1.AddChildEquipment(_grandCildEquipment1_1);
            _childEquipment1.AddChildEquipment(_grandCildEquipment1_2);
            _childEquipment1.AddChildEquipment(_grandCildEquipment1_3);
            _childEquipment2.AddChildEquipment(_grandCildEquipment2_1);
            _childEquipment2.AddChildEquipment(_grandCildEquipment2_2);

            using (var session = _sessionFactory.OpenSession())
            {
                session.Save(_rootEquipment);
                session.Flush();
            }
        }
예제 #4
0
 public static Equipment get() {
   if(_instance == null) {
     Logger.Log("Equipment::get was badly initialized", Logger.Level.WARN);
     _instance = GameObject.Find(gameObjectName).GetComponent<Equipment>();
   }
   return _instance;
 }
예제 #5
0
 ///<summary>Inserts one Equipment into the database.  Returns the new priKey.</summary>
 internal static long Insert(Equipment equipment)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         equipment.EquipmentNum=DbHelper.GetNextOracleKey("equipment","EquipmentNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(equipment,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     equipment.EquipmentNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(equipment,false);
     }
 }
예제 #6
0
    //dan
    //protected PlayerRotation PlayerRot;
    // =============================================================================
    // =============================================================================
    // METHODS UNITY ---------------------------------------------------------------
    protected virtual void Awake()
    {
        Config = GameObject.FindWithTag ( "Config" ).GetComponent<Config> ();

        Trans = transform;
        Audio = audio;
        NetView = networkView;

        GameObject player = GameObject.FindWithTag ( "Player" );
        PlayerMov = player.GetComponent<PlayerMovement> ();

        //dan
        //TODO: fix player Rotation
        //PlayerRot = player.GetComponent<PlayerRotation> ();
        Equip = gameObject.GetComponent<Equipment> ();

        if ( DisplayLeft )
        {
            DisplayLeft.renderer.material.color = DisplayColor;
        }
        if ( DisplayRight )
        {
            DisplayRight.renderer.material.color = DisplayColor;
        }
    }
예제 #7
0
 private void ProcessEqu(Equipment sourceEquipment, int _playerId)
 {
     equipment = new InvItem[sourceEquipment.GetSlotCount ()];
     for (int i = 0; i < sourceEquipment.GetSlotCount (); i++) {
         equipment [i] = CreateInvItem (sourceEquipment.GetSlotItem (i), 1, _playerId);
     }
 }
예제 #8
0
 public List<Equipment> AddEquipment(Equipment equipment)
 {
     List<Equipment> toBeRemoved = new List<Equipment>();
     for(int i=0;i<equipped.Count;i++){
         if(equipped[i].GetType() == equipment.GetType()){
             AddToInventory(equipped[i],1);
             equipped[i] = equipment;
             toBeRemoved.Add(equipped[i]);
             return null;
         }
         if(equipment is TwoHanded){
             if(equipped[i] is OneHanded)
                 toBeRemoved.Add(equipped[i]);
         }
         if(equipment is OneHanded){
             if(equipped[i] is TwoHanded)
                 toBeRemoved.Add(equipped[i]);
         }
     }
     foreach(Equipment equip in toBeRemoved){
         AddToInventory(equip,1);
         equipped.Remove(equip);
     }
     equipped.Add(equipment);
     return null;
 }
예제 #9
0
 /**
  * Attempt to add an item to this grid in any spot that it will fit
  * Return false if no space
  */
 public override bool AddItem(Equipment item)
 {
     InventoryGridItem gridItem = item.inventoryGridItem;
     for (int i = 0; i + gridItem.width <= numTilesX; i++) {
         for (int j = 0; j + gridItem.height <= numTilesY; j++) {
             // If the item fits, add it to the inventory
             if (CanItemFit(item.inventoryGridItem, i, j)) {
                 bool inserted = base.AddItem(item);
                 // If it was successfully added, add it to the grid
                 if (inserted) {
                     gridItem.x = i;
                     gridItem.y = j;
                     for (int k = 0; k < gridItem.width; k++)
                         for (int q = 0; q < gridItem.height; q++)
                             gridFills[gridItem.x + k, gridItem.y + q] = true;
                     // Auto add it to an available hotkey slot if the item is flagged to do so
                     if (item.inventoryGridItem.autoAddToHotkey) {
                         for (int q = 0; q < numHotkeys; q++) {
                             if (hotkeyItems[q] == null) {
                                 hotkeyItems[q] = item;
                                 break;
                             }
                         }
                     }
                 }
                 return inserted;
             }
         }
     }
     return false;
 }
예제 #10
0
 public override void OnEnable()
 {
     e = target as Equipment;
     fdb = e.fdb;
     base.OnEnable();
     name = "Equipment";
 }
        public MTBISummaryManager(Equipment.EquipmentBase equipment)
        {
            EquipmentInstance = equipment;
            AlarmList = new List<string>();
            Load();

            Run = true;

            Thread thread = new Thread(
                    delegate()
                    {
                        while (Run)
                        {
                            Action log;

                            if (_logQueue.Count > 0)
                            {
                                lock (threadRoot)
                                {
                                    log = _logQueue.Dequeue();
                                }

                                log();
                            }

                            Thread.Sleep(10);
                        }
                    });

            thread.Start();
        }
예제 #12
0
 public void RemoveEquipment(Equipment equipment)
 {
     if(equipped.Contains(equipment)){
         AddToInventory(equipment,1);
         equipped.Remove(equipment);
     }
 }
예제 #13
0
    public void Login()
    {
        if (username.text.Trim ().Equals ("")) {
            ShowHint.Hint (StringCollection.NEEDUSERNAME);
            return;
        }

        if (password.text.Trim ().Equals ("")) {
            ShowHint.Hint (StringCollection.NEEDPASSWORD);
            return;
        }

        bool vali = false;

        //去服务器验证
        vali = true;
        //如果成功
        if (vali) {

            bool haveInfo = true;

            if (haveInfo) {
                //如果有玩家信息,加载并跳转城市场景

                //从服务器端获取玩家数据初始化
                gData.isPlayer = false; //初始的时候总是佣兵模式,玩家在线后与其他玩家组队,才会变成联机模式
                gData.characterList = new List<Character> ();

                Equipment e = new Equipment (1, 2, 0, 0, Equipment.EquipPos.BODY, "2", "学者的思考", 1, 200);
                List<Equipment> eList = new List<Equipment> ();
                eList.Add (e);

                Character c = new Character (2000, 30, 100, 0, 0, "zhouhui", true, 50, 0, ProFactory.getPro ("Geomancer", "1"), 10, 0, eList, -1);

                HealthItem item = new HealthItem (Item.RangeType.SINGLE, 10, "1", "单体治疗药剂", 50);
                List<Baggrid> bgList = new List<Baggrid> ();
                Baggrid bg = new Baggrid (item, 2);
                bgList.Add (bg);

                //		Equipment e2 = new Equipment(2,3,Equipment.EquipPos.BODY,"3","学者的幻想",1,500);
                //		Baggrid bg2 = new Baggrid (e2, 1);
                //		bgList.Add (bg2);

                c.BgList = bgList;
                gData.characterList.Add (c);
                Character c2 = new Character (0, 40, 100, 0, 0, "unity", false, 100, 100, ProFactory.getPro ("Settler", "1"), 1, 0, null, -1);
                gData.characterList.Add (c2);

                Application.LoadLevel ("city");

            } else {
                //如果没有,跳转角色创建场景
                Application.LoadLevel ("create");
            }

        } else {
            ShowHint.Hint (StringCollection.INVALIDACCOUNT);
        }
    }
예제 #14
0
 public override void LoadContent(Equipment owner, ContentManager content, ManagerMap managerMap, ManagerCamera managerCamera, Entities entities)
 {
     base.LoadContent(owner, content, managerMap, managerCamera,entities);
     AddComponent(new Sprite(ManagerContent.LoadTexture("sword"), 16, 16, new Vector2(0, 0)));
     AddComponent(new Animation(16,16,2,100));
     AddComponent(new Camera(managerCamera));
     GuiTexture = ManagerContent.LoadTexture("sword_gui");
 }
예제 #15
0
 public void Initialize(Equipment.DependencyEquipments.TrayLoadingUnit unit)
 {
     UIUtility.SetActionsOfGeneralPartToButton(buttonClamp, unit.LeftTrayClamp, "EXTEND", "RETRACT");
     UIUtility.SetActionsOfGeneralPartToButton(buttonFirstLifter, unit.FirstTrayLifter, "UP", "DOWN");
     UIUtility.SetActionsOfGeneralPartToButton(buttonSecondLifter, unit.SecondTrayLifter, "UP", "DOWN");
     UIUtility.SetActionsOfGeneralPartToButton(buttonTraySeperator, unit.FrontLeftTraySeperator , "UP", "DOWN");
     UIUtility.SetActionsOfOneWayMotorPartToButton(buttonConveyor, unit.Conveyor);
 }
예제 #16
0
        public void AddEquipment(Equipment equipment)
        {
            if (equipment == null)
            {
                throw new ArgumentNullException("The equipment connot be null.");
            }

            this.equipments.Add(equipment);
        }
 public override void LoadContent(Equipment owner, ContentManager content, ManagerMap managerMap, ManagerCamera managerCamera, Entities entities)
 {
     base.LoadContent(owner,content,managerMap,managerCamera,entities);
     AddComponent(new Sprite(content.Load<Texture2D>("boomerang"),16,16,new Vector2(0,0)));
     AddComponent(new Collision(managerMap,entities));
     AddComponent(new Animation(16,16,3));
     AddComponent(new Camera(managerCamera));
     GuiTexture = content.Load<Texture2D>("boomerang_gui");
 }
예제 #18
0
 public void Clear()
 {
     Head = null;
     Torso = null;
     LeftHand = null;
     RightHand = null;
     Ring = null;
     Amulet = null;
 }
 public void AddWeapon(Equipment equip, int numb, bool right, int wActNumb, SpFunctions sp)
 {
     int i,j;
     int cLen = equip.bag [numb].GetComponent<ItemClass>().coordinates.Length/3;
     CharacterAnimator anim = equip.gameObject.GetComponent<CharacterAnimator> ();
     ItemClass item = equip.bag [numb].GetComponent<ItemClass> ();
     GameObject weapon;
     weapon = Instantiate (right == true ? item.objects [0] : item.objects [1],
                           new Vector3 (equip.gameObject.transform.position.x + item.coordinates [0]*equip.gameObject.transform.lossyScale.x,
                  equip.gameObject.transform.position.y + item.coordinates [1]*equip.gameObject.transform.lossyScale.y,
                  equip.gameObject.transform.position.z + item.coordinates [2]),
                           equip.gameObject.transform.rotation)as GameObject;
     weapon.transform.localScale=new Vector3(weapon.transform.localScale.x*sp.realSign(equip.gameObject.transform.localScale.x),
                                             weapon.transform.localScale.y,
                                             weapon.transform.localScale.z);
     weapon.transform.SetParent (equip.gameObject.transform);
     sp.SetMoveset(equip.gameObject,weapon.GetComponent<WeaponClass>());
     j = 0;
     while (j<item.parametres1.Length) {
         if (item.parametres1 [j] != 0)
             break;
         anim.allParts [item.parametres2 [j]].parts.Add (weapon.GetComponent<PartConroller> ());
         j++;
     }
     for (i=2; i<equip.bag[numb].GetComponent<ItemClass>().objects.Length; i++) {
         listOfObjects.Add (GameObject.Instantiate (item.objects [i],
                                                    new Vector3 (equip.gameObject.transform.position.x + item.coordinates [i * cLen]*equip.gameObject.transform.lossyScale.x,
                      equip.gameObject.transform.position.y + item.coordinates [i * cLen + 1]*equip.gameObject.transform.lossyScale.y,
                      equip.gameObject.transform.position.z + item.coordinates [i * cLen + 2]),
                                                    equip.gameObject.transform.rotation)as GameObject);
         listOfObjects [i-2].transform.localScale=new Vector3(listOfObjects [i-2].transform.localScale.x*sp.realSign(equip.gameObject.transform.localScale.x),
                                                              listOfObjects [i-2].transform.localScale.y,
                                                              listOfObjects [i-2].transform.localScale.z);
         listOfObjects [i-2].transform.SetParent (equip.gameObject.transform);
         listOfObjects[i-2].GetComponent<PartConroller>().right=(right==true? 1: -1);
         while (j<item.parametres1.Length) {
             if (item.parametres1 [j] != i)
                 break;
             anim.allParts [item.parametres2 [j]].parts.Add (listOfObjects [i-2].GetComponent<PartConroller> ());
             j++;
         }
     }
     equip.gameObject.GetComponent<Actions> ().activities [wActNumb].weapon = weapon.GetComponent<WeaponClass> ();
     equip.gameObject.GetComponent<Actions> ().activities [wActNumb].actMode = numb;
     if (weapon.GetComponent<WeaponClass> ().handEmployment == 2)
     {
         equip.gameObject.GetComponent<Actions> ().activities [wActNumb-1].weapon = weapon.GetComponent<WeaponClass> ();
         equip.gameObject.GetComponent<Actions> ().activities [wActNumb-1].actMode = numb;
         equip.leftWeapon=weapon.GetComponent<WeaponClass>();
     }
     if (right)
         equip.rightWeapon=weapon.GetComponent<WeaponClass>();
     else
         equip.leftWeapon=weapon.GetComponent<WeaponClass>();
     listOfObjects.Clear ();
 }
예제 #20
0
 public EquipmentManage(MainDataContexts dataContexts,Area area,Equipment manageEquipment, int buttonTag)
 {
     InitializeComponent();
     _dataContexts = dataContexts;
     _manageEquipment = manageEquipment;
     _buttonTag = buttonTag;
     _area = area;
     lbPorts.MultiSelect = true;
     lbCards.MultiSelect = true;
 }
예제 #21
0
    void Start()
    {
        _equipment = GetComponent<Equipment>();
        _camera = Camera.main.GetComponent<CameraController>();

        rightHand = _equipment.First(slot => ((slot.region == EquipmentRegion.Hands) &&
                                              slot.tags.Contains(EquipmentTag.Held, EquipmentTag.Right)));
        leftHand  = _equipment.First(slot => ((slot.region == EquipmentRegion.Hands) &&
                                              slot.tags.Contains(EquipmentTag.Held, EquipmentTag.Left)));
    }
예제 #22
0
 // Use this for initialization
 void Start()
 {
     ViewParameter viewParameter = ViewParameter.Instance;
     int ueid = viewParameter.getIntValue ("ueid");
     int urid = viewParameter.getIntValue ("urid");
     Hashtable userRolesMap = User.Instance.userRolesMap;
     userRole = (UserRole)userRolesMap [urid];
     e = (Equipment) (User.Instance).equipMap [ueid];
     dis = SlgDispatcher.Instance;
 }
 public ActionResult Edit(Equipment equipment)
 {
     if (ModelState.IsValid)
     {
         context.Entry(equipment).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(equipment);
 }
예제 #24
0
 public InventoryGridItem(InventoryGridItem copy)
 {
     this.texture = copy.texture;
     this.textureHotkey = copy.textureHotkey;
     this.width = copy.width;
     this.height = copy.height;
     this.x = copy.x;
     this.y = copy.y;
     this.equipment = copy.GetEquipment();
 }
예제 #25
0
 public Actor(String name, Races race, Genders gender)
 {
     stats = new StatsDatum();
     equipment = new Equipment();
     skills = new List<Skill>();
     statusEffects = new List<StatusEffect>();
     this.name = name;
     this.race = race;
     this.gender = gender;
 }
예제 #26
0
 public Minion()
     : base()
 {
     Inventory = new Inventory();
     ActionTimeCurrent = 0;
     UsedDefend = false;
     IsActive = false;
     IsAlive = true;
     hpText = new FloatingText();
     equipedWeapon = null;
 }
예제 #27
0
 public Entity(GameWorld world)
 {
     World = world;
     Article = Article.Indefinite;
     BaseAttributes = CombatAttributes.Default;
     Equipment = new Equipment();
     Inventory = new List<Item>();
     TimeSinceAttack = TimeSpan.FromSeconds(30);
     Hp = BaseAttributes.MaxHp;
     Observers = new List<IObserver>();
 }
예제 #28
0
	/**
	 * The Start method is called automatically by Monobehaviors,
	 * essentially becoming the constructor of the class.
	 * <p>
	 * See <a href="http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html">docs.unity3d.com</a> for more information.
	 */
	private void Start() {
		bobTimer = 0.0f;
		player = GetComponent<Player> ();
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
		equipment = GameObject.Find("Equipment").GetComponent<Equipment>();
        viewmodel = null;

        guiController = GameObject.Find("Graphical User Interface").GetComponent<GUIController>();
        audioSource = GetComponent<AudioSource>();
    }
        public ActionResult Create(Equipment equipment)
        {
            if (ModelState.IsValid)
            {
                context.Equipments.Add(equipment);
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(equipment);
        }
 public ActionResult AddEquipment(Equipment t)
 {
     if (ModelState.IsValid)
     {
         db.Equipments.Add(t);
         db.SaveChanges();
         TempData["Success"] = t.Name + " added successfully.";
         return RedirectToAction("ManageEquipment", "Manager");
     }
     return View();
 }
예제 #31
0
        public static void Initialization(TestContext testContext)
        {
            _context = new DbContext();

            _playgroundRepository      = new PlaygroundsRepository(_context);
            _certificateRepository     = new CertificateRepository(_context);
            _companiesRepository       = new CompaniesRepository(_context);
            _equipmentsRepository      = new EquipmentRepository(_context);
            _equipmentOrdersRepository = new EquipmentOrdersRepository(_context);
            _eventsRepository          = new EventsRepository(_context);
            _gamesRepository           = new GamesRepository(_context);
            _gameTypesRepository       = new GameTypesRepository(_context);
            _newsRepository            = new NewsRepository(_context);
            _operationsRepository      = new OperationsRepository(_context);
            _tasksRepository           = new TasksRepository(_context);

            _userStore = new UserStore <IdentityUser>(_context);

            _firstUser = _userStore.Users.FirstOrDefault();

            _companyToDelete = _companiesRepository.CreateOrUpdate(new Company
            {
                Name    = "TestCompanyName",
                Adress  = "TestAdress",
                OwnerId = _firstUser.Id
            });
            _firstUser.CompanyId = _companyToDelete.Id;
            _userStore.Update(_firstUser);

            _playgroundToDelete = _playgroundRepository.CreateOrUpdate(new Playground
            {
                CompanyId = _companyToDelete.Id,
                Name      = "TestPlaygroundName",
                Price     = 100
            });

            _certificateToDelete = _certificateRepository.CreateOrUpdate(new Certificate
            {
                FirstName = "TestCertificateFirstName",
                LastName  = "TestCertificateLastName",
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now.AddYears(1),
                Price     = 100,
                CompanyId = _companyToDelete.Id
            });

            _equipmentToDelete = _equipmentsRepository.CreateOrUpdate(new Equipment
            {
                Name      = "TestEquipmentName",
                Price     = 100,
                Count     = 50,
                CompanyId = _companyToDelete.Id
            });

            _gameTypeToDelete = _gameTypesRepository.CreateOrUpdate(new GameType
            {
                Name      = "TestGameTypeName",
                Price     = 100,
                CompanyId = _companyToDelete.Id
            });

            _gameToDelete = _gamesRepository.CreateOrUpdate(new Game
            {
                CreatorId   = _firstUser.Id,
                BeginDate   = DateTime.Now,
                GameType    = _gameTypeToDelete.Id,
                Playground  = _playgroundToDelete.Id,
                PlayerCount = 10,
                GamePrice   = 100,
                CompanyId   = _companyToDelete.Id
            });

            _equipmentOrderToDelete = _equipmentOrdersRepository.CreateOrUpdate(new EquipmentOrder
            {
                GameId      = _gameToDelete.Id,
                EquipmentId = _equipmentToDelete.Id,
                Count       = 10
            });

            _eventToDelete = _eventsRepository.CreateOrUpdate(new Event
            {
                GameId      = _gameToDelete.Id,
                CompanyId   = _companyToDelete.Id,
                Title       = "NewTestTitle",
                Description = "<p>New Description</p><p>New Test Description</p>"
            });

            _newsToDelete = _newsRepository.CreateOrUpdate(new News
            {
                Title       = "TestNewsTitle",
                PublishDate = DateTime.Now,
                Text        = "TestNewsText",
                CompanyId   = _companyToDelete.Id
            });

            _operationToDelete = _operationsRepository.CreateOrUpdate(new Operation
            {
                Price     = _gameToDelete.GamePrice,
                Date      = DateTime.Now,
                CompanyId = _companyToDelete.Id,
            });

            _taskToDelete = _tasksRepository.CreateOrUpdate(new Task
            {
                StaffId     = _firstUser.Id,
                Text        = "TestTaskText",
                CompanyId   = _companyToDelete.Id,
                IsCompleted = false
            });
        }
예제 #32
0
 public static Equipment UpgradeEquipment(Equipment equipment)
 {
     equipment.LevelUp();
     return(equipment);
 }
예제 #33
0
 public IEnumerable <string> GetDisplayEquipmentList()
 {
     return(Equipment.Select(equipment => $"{equipment.Value.Icon} *{equipment.Value.Name}*"));
 }
        /// <summary>
        /// 赋值测长下线属性
        /// </summary>
        /// <param name="MeasuringLength"></param>
        public void SetMeasuringLengthMonitorProps(Equipment MeasuringLength)
        {
            Self = MeasuringLength;

            #region 固定属性赋值
            var OperationModel = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.OperationModel.ToString());
            if (OperationModel != null)
            {
                txt_OperationModel.Foreground = Brushes.Blue;
                switch (OperationModel.Value)
                {
                case "1":
                    txt_OperationModel.Text = "维修";
                    break;

                case "2":
                    txt_OperationModel.Text = "手动";
                    break;

                case "3":
                    txt_OperationModel.Text = "机载操作";
                    break;

                case "4":
                    txt_OperationModel.Text = "单机自动";
                    break;

                case "5":
                    txt_OperationModel.Text = "联机";
                    break;

                default:
                    txt_OperationModel.Text       = "未知";
                    txt_OperationModel.Foreground = Brushes.Red;
                    break;
                }
            }

            var TotalError = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.TotalError.ToString()).Value;
            if (TotalError != null)
            {
                txt_TotalError.Text = TotalError;
            }
            var RequestMessage = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.RequestMessage.ToString()).Value;
            if (RequestMessage != null)
            {
                txt_RequestMessage.Foreground = Brushes.Blue;
                switch (RequestMessage)
                {
                case "1":
                    txt_RequestMessage.Text = "请求下料";
                    break;

                case "2":
                    txt_RequestMessage.Text = "手动请求";
                    break;

                case "0":
                    txt_RequestMessage.Text = "无信号";
                    break;

                default:
                    txt_RequestMessage.Text       = "未定义";
                    txt_RequestMessage.Foreground = Brushes.Red;
                    break;
                }
            }
            var RequestNumber = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.RequestNumber.ToString()).Value;
            if (RequestNumber != null)
            {
                txt_RequestNumber.Text = RequestNumber;
            }
            var RequestTaskId = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.RequestTaskId.ToString()).Value;
            if (RequestTaskId != null)
            {
                txt_RequestTaskId.Text = RequestTaskId;
            }
            var RequestBarcode = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.RequestBarcode.ToString()).Value;
            if (RequestBarcode != null)
            {
                txt_RequestBarcode.Text = RequestBarcode;
            }
            //var RequestProductId = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.RequestProductId.ToString()).Value;
            //if (RequestProductId != null)
            //{
            //    txt_RequestProductId.Text = RequestProductId;
            //}

            var RequestBackup = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.RequestBackup.ToString()).Value;
            if (RequestBackup != null)
            {
                txt_RequestBackup.Text = RequestBackup;
            }

            var WCSReplyMessage = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSReplyMessage.ToString()).Value;
            if (WCSReplyMessage != null)
            {
                txt_WCSReplyMessage.Foreground = Brushes.Blue;
                switch (WCSReplyMessage)
                {
                case "6":
                    txt_WCSReplyMessage.Text = "响应请求";
                    break;

                case "":
                    break;

                default:
                    txt_WCSReplyMessage.Text = WCSReplyMessage;
                    break;
                }
            }
            var WCSReplyNumber = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSReplyNumber.ToString()).Value;
            if (WCSReplyNumber != null)
            {
                txt_WCSReplyNumber.Text = WCSReplyNumber;
            }
            var WCSReplyBarcode = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSReplyBarcode.ToString()).Value;
            if (WCSReplyBarcode != null)
            {
                txt_WCSReplyBarcode.Text = WCSReplyBarcode;
            }
            var WCSReplyAddress = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSReplyAddress.ToString()).Value;
            if (WCSReplyAddress != null)
            {
                txt_WCSReplyAddress.Text = WCSReplyAddress;
            }
            var WCSReplyProductId = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSReplyProductId.ToString()).Value;
            if (WCSReplyProductId != null)
            {
                txt_WCSReplyProductId.Text = WCSReplyProductId;
            }
            var WCSReplyTaskId = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSReplyTaskId.ToString()).Value;
            if (WCSReplyTaskId != null)
            {
                txt_WCSReplyTaskId.Text = WCSReplyTaskId;
            }

            var WCSReplyBackup = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSReplyBackup.ToString()).Value;
            if (WCSReplyBackup != null)
            {
                txt_WCSReplyBackup.Text = WCSReplyBackup;
            }

            //var WCSACKNumber = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CuttingMonitorProps.WCSACKNumber.ToString()).Value;
            //if (WCSACKNumber != null)
            //{
            //    //.Text = WCSACKNumber;
            //}

            #endregion
        }
예제 #35
0
파일: EquipUI.cs 프로젝트: NurislamK/Game
 private void Start()
 {
     unit             = GameObject.FindGameObjectWithTag("Unit").gameObject;
     changeGearScript = unit.GetComponent <ChangeGear>();
     equipmentScript  = unit.GetComponent <Equipment>();
 }
예제 #36
0
 public void OnChosen(Equipment equipment) => equipment.ChooseBodyPart(this);
예제 #37
0
        public void RedImbue(Equipment Item, ImbueStat stat, ref int value, bool success, ref ImbueError error)
        {
            if (success)
            {
                error = ImbueError.Success;
            }
            else
            {
                error = ImbueError.FailedToRemake;
                if (PercentSuccess(30))
                {
                    value *= -1;
                }
                else
                {
                    value *= 0;
                }
            }

            switch (stat)
            {
            case ImbueStat.RequiredLevel:
                if (Item.RequiredLevel >= -value)
                {
                    Item.RequiredLevel += (short)value;
                }
                else
                {
                    Item.RequiredLevel = 0;
                }
                return;

            case ImbueStat.RequiredStrength:
                if (Item.RequiredStrength >= -value)
                {
                    Item.RequiredStrength += (short)value;
                }
                else
                {
                    Item.RequiredStrength = 0;
                }
                return;

            case ImbueStat.RequiredStamina:
                if (Item.RequiredStamina >= -value)
                {
                    Item.RequiredStamina += (short)value;
                }
                else
                {
                    Item.RequiredStamina = 0;
                }
                return;

            case ImbueStat.RequiredDexterity:
                if (Item.RequiredDexterity >= -value)
                {
                    Item.RequiredDexterity += (short)value;
                }
                else
                {
                    Item.RequiredDexterity = 0;
                }
                return;

            case ImbueStat.RequiredEnergy:
                if (Item.RequiredEnergy >= -value)
                {
                    Item.RequiredEnergy += (short)value;
                }
                else
                {
                    Item.RequiredEnergy = 0;
                }
                return;

            default:
                stat = ImbueStat.None;
                return;
            }
        }
예제 #38
0
 /// <summary>
 /// 角色穿戴装备.
 /// </summary>
 /// <param name="pEquip">装备对象</param>
 public void WearEquipment(Equipment pEquip)
 {
     WearEquipment(pEquip.equipPos, pEquip);
 }
        /// <summary>
        /// 以堆垛机状态驱动,重写堆垛机控制逻辑
        /// hack:1.注意此处改动:堆垛机任务完成不再以状态去查找任务,以堆垛机携带的任务号为准;2.标准实现中不支持跨巷道移库
        /// </summary>
        /// <param name="stocker"></param>
        /// <param name="plc"></param>
        /// <returns></returns>
        public BllResult ExcuteSingle(Equipment stocker, List <Equipment> allEquipments, IPLC plc)
        {
            //联机、无故障
            if (Validate(stocker).Success)
            {
                #region 堆垛机任务执行判断
                if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskExcuteStatus.ToString()).Value == SRMTaskExcuteStatus.任务执行中.GetIndexString())
                {
                    //任务执行中就return
                    return(BllResultFactory.Sucess());
                }
                if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskExcuteStatus.ToString()).Value == SRMTaskExcuteStatus.任务中断_出错.GetIndexString())
                {
                    //由人工处理,一般为空出和重入
                    return(BllResultFactory.Sucess());
                }
                if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskExcuteStatus.ToString()).Value == SRMTaskExcuteStatus.发任务错误.GetIndexString())
                {
                    //由人工处理,需要重新下发任务
                    return(BllResultFactory.Sucess());
                }
                #endregion

                #region 任务,货位和本巷道的其他设备

                //找出所有未完成的任务
                var tasksResult = AppSession.Dal.GetCommonModelByCondition <TaskEntity>($"where taskStatus < {TaskEntityStatus.任务完成.GetIndexInt()} " +
                                                                                        $"and taskStatus>={TaskEntityStatus.下发任务.GetIndexInt()} and deleted = 0 and warehouseCode={AppSession.WarehouseCode}");
                if (!tasksResult.Success)
                {
                    //如果没有找到任务就直接返回
                    return(BllResultFactory.Error(tasksResult.Msg));
                }
                //找出同巷道的库位,考虑到可能多个巷道移库,这里分别查询出所有库位和当前堆垛机所在的库位
                var locationsResult = AppSession.LocationService.GetAllLocationsByColumnSpanAndRoadway(ManageSmallColumn, ManageBigColumn, stocker.RoadWay, stocker.WarehouseCode);
                if (!locationsResult.Success)
                {
                    return(BllResultFactory.Error(locationsResult.Msg));
                }
                var locationsRoadWay = locationsResult.Data;

                //找出本巷道的所有设备
                var tempEquipments = allEquipments.Where(t => t.RoadWay == stocker.RoadWay && t.WarehouseCode == stocker.WarehouseCode).ToList();
                //可用站台
                //var availableStation = AppSession.ExcuteService.GetAvailableStation(tempEquipments);
                //hack:注意,此处需要配置StationStatusMonitor!
                var availableStation = tempEquipments.Where(t => t.EquipmentType.Code.Contains("Station") &&
                                                            tempEquipments.First(a => a.EquipmentType.Code == "StationStatusMonitor").EquipmentProps.
                                                            Count(b => b.EquipmentTypeTemplateCode == t.StationIndex.ToString() && b.Value == StationTaskLimit.可出.GetIndexString()) > 0).ToList();

                //hack:这里筛选本巷道或关联到本巷道的任务,规则为起始或目标库位,所以,当将来出现跨巷道移库时,需要特别处理跨巷道移库任务
                var tasks = tasksResult.Data.Where(t => locationsRoadWay.Count(a => a.Code == t.FromLocationCode || a.Code == t.ToLocationCode) > 0).ToList();

                #endregion

                //堆垛机待机情况下
                if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskExcuteStatus.ToString()).Value == SRMTaskExcuteStatus.待机.GetIndexString())
                {
                    //货叉任务待机时,可执行放和取任务,同时当执行完成时,交互后堆垛机会从任务完成更新为待机
                    if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.WCSFork1TaskFlag.ToString()).Value == SRMForkTaskFlag.任务完成.GetIndexString())
                    {
                        return(ClearWCSData(stocker, plc));
                    }
                    else if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.WCSFork1TaskFlag.ToString()).Value == SRMForkTaskFlag.无任务.GetIndexString())
                    {
                        #region 优先处理重新下发的任务

                        var taskForResend = tasks.FirstOrDefault(t => t.TaskStatus == TaskEntityStatus.发堆垛机库内取货.GetIndexInt() && locationsRoadWay.Count(a => a.Code == t.FromLocationCode) > 0 && t.SendAgain == 1);
                        if (taskForResend != null)
                        {
                            var locationForResend = locationsRoadWay.Find(t => t.Code == taskForResend.FromLocationCode);
                            // 根据任务的来源库位和堆垛机编号进行判断,如果相同则1,不同用2
                            var rowIndex = stocker.Code == locationForResend.SrmCode ? locationForResend.RowIndex1 : locationForResend.RowIndex2;
                            return(ReSendTask(stocker, plc, rowIndex.ToString(), locationForResend.Line.ToString(), locationForResend.Layer.ToString(), "0", taskForResend, SRMForkTaskFlag.库内取货));
                        }

                        taskForResend = tasks.FirstOrDefault(t => t.TaskStatus == TaskEntityStatus.发堆垛机库内放货.GetIndexInt() && locationsRoadWay.Count(a => a.Code == t.ToLocationCode) > 0 && t.SendAgain == 1);
                        if (taskForResend != null)
                        {
                            var locationForResend = locationsRoadWay.Find(t => t.Code == taskForResend.ToLocationCode);
                            // 根据任务的来源库位和堆垛机编号进行判断,如果相同则1,不同用2
                            var rowIndex = stocker.Code == locationForResend.SrmCode ? locationForResend.RowIndex1 : locationForResend.RowIndex2;
                            return(ReSendTask(stocker, plc, rowIndex.ToString(), locationForResend.Line.ToString(), locationForResend.Layer.ToString(), "0", taskForResend, SRMForkTaskFlag.库内放货));
                        }

                        //取货时,此站台得在本巷道内
                        //hack:一般情况下不存在同个巷道多个重新下发的任务,如果存在,此处需要特别处理
                        taskForResend = tasks.FirstOrDefault(t => t.TaskStatus == TaskEntityStatus.发堆垛机库外取货.GetIndexInt() &&
                                                             tempEquipments.Count(a => a.Code == t.Gateway) > 0 &&
                                                             t.SendAgain == 1);
                        if (taskForResend != null)
                        {
                            //使用task的ArrivaEquipmentCode来记录task对应托盘当前或上一次所在的口,则此处通过ArrivaEquipmentCode来查找当前task所在的口
                            var stationResult = tempEquipments.First(t => t.Code == taskForResend.Gateway);
                            return(ReSendTask(stocker, plc, stationResult.RowIndex1.ToString(), stationResult.ColumnIndex.ToString(), stationResult.LayerIndex.ToString(), stationResult.StationIndex.ToString(), taskForResend, SRMForkTaskFlag.库外取货));
                        }

                        taskForResend = tasks.FirstOrDefault(t => t.TaskStatus == TaskEntityStatus.发堆垛机库外放货.GetIndexInt() && t.Gateway == stocker.Code && t.SendAgain == 1);
                        if (taskForResend != null)
                        {
                            var stationsResult = AppSession.ExcuteService.GetOutStationByPort(stocker.DestinationArea, taskForResend.ToPort, App.WarehouseCode);
                            if (!stationsResult.Success)
                            {
                                return(BllResultFactory.Error($"重新下发任务出错:{stationsResult.Msg}"));
                            }
                            //这些站台要在可用的站台列表中并选取离堆垛机最近的一个站台
                            //var station = stationsResult.Data.Where(t => availableStation.Count(a => a.Code == t.Code) > 0).OrderBy(t => CurrentColumn - t.ColumnIndex).FirstOrDefault();
                            var station = availableStation.Find(t => t.Code == stationsResult.Data[0].Code);
                            if (station == null)
                            {
                                Logger.Log($"堆垛机{stocker.Name}当前没有可用的站台可以放货,任务:{taskForResend.Id}", LogLevel.Warning);
                                return(BllResultFactory.Error());
                            }
                            else
                            {
                                return(ReSendTask(stocker, plc, station.RowIndex1.ToString(), station.ColumnIndex.ToString(), station.LayerIndex.ToString(), station.StationIndex.ToString(), taskForResend, SRMForkTaskFlag.库外放货));
                            }
                        }

                        #endregion

                        //判断堆垛机货叉上是不是有货,有货就只能接受放货任务,无货就可以接受取货任务
                        if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1ForkHasPallet.ToString()).Value == "True")
                        {
                            //有货,则查找同巷道的取货任务完成状态的任务,同一个堆垛机,单叉情况下最多一条
                            #region 判断是否超出一条
                            if (tasks.Count(t => (t.TaskStatus == TaskEntityStatus.响应堆垛机库内取货完成.GetIndexInt() || t.TaskStatus == TaskEntityStatus.响应堆垛机库外取货完成.GetIndexInt()) && t.Gateway == stocker.Code) > 1)
                            {
                                Logger.Log($"堆垛机{stocker.Name}显示货叉上有货,但是对应的任务超过1条,请检查状态为{TaskEntityStatus.响应堆垛机库内取货完成}和{TaskEntityStatus.响应堆垛机库外取货完成}的任务", LogLevel.Error);
                                return(BllResultFactory.Error());
                            }
                            #endregion
                            //先找库内取货完成的任务
                            var task = tasks.FirstOrDefault(t => t.TaskStatus == TaskEntityStatus.响应堆垛机库内取货完成.GetIndexInt() && t.Gateway == stocker.Code);
                            if (task == null)
                            {
                                //如果没有就找库外取货完成的任务,此任务以ArrivaEquipmentCode去查找堆垛机任务
                                task = tasks.FirstOrDefault(t => t.TaskStatus == TaskEntityStatus.响应堆垛机库外取货完成.GetIndexInt() && t.Gateway == stocker.Code);
                            }
                            if (task == null)
                            {
                                //如果还是没有找到任务,那就说明的确没有这条任务,或是人为原因导致的,但此时又显示货叉有货,所以这里是有问题的,做个日志
                                Logger.Log($"堆垛机{stocker.Name}显示货叉上有货,但是没有对应的任务", LogLevel.Error);
                                return(BllResultFactory.Error());
                            }
                            else
                            {
                                //判断任务类型
                                //移库
                                if (task.TaskType == TaskType.移库.GetIndexInt())
                                {
                                    //是否同巷道
                                    var tempLocation = locationsRoadWay.FirstOrDefault(t => t.Code == task.ToLocationCode);
                                    if (tempLocation != null)
                                    {
                                        //同一个巷道,则直接下发库内放货
                                        return(SendTaskToLocation(stocker, plc, task, tempLocation, TaskEntityStatus.发堆垛机库内放货, SRMForkTaskFlag.库内放货, task.TaskStatus));
                                    }
                                    else
                                    {
                                        //hack:默认不支持巷道间的移库,如需要则请按实际情况自行实现
                                        Logger.Log($"任务:{task.Id}对应去向货位{task.ToLocationCode}不在本巷道中,请检查任务数据", LogLevel.Error);
                                        return(BllResultFactory.Error());
                                    }
                                }
                                else if (task.TaskType == TaskType.整盘出库.GetIndexInt() || task.TaskType == TaskType.空容器出库.GetIndexInt() || task.TaskType == TaskType.换站.GetIndexInt())
                                {
                                    //整出任务,空盘出库和换站,都是奔着port去的:
                                    var stationsResult = AppSession.ExcuteService.GetOutStationByPort(stocker.DestinationArea, taskForResend.ToPort, App.WarehouseCode);
                                    if (!stationsResult.Success)
                                    {
                                        Logger.Log(stationsResult.Msg, LogLevel.Error);
                                        return(BllResultFactory.Error(stationsResult.Msg));
                                    }
                                    var station = stationsResult.Data.Where(t => availableStation.Count(a => a.Code == t.Code) > 0).OrderBy(t => CurrentColumn - t.ColumnIndex).FirstOrDefault();
                                    if (station == null)
                                    {
                                        Logger.Log($"堆垛机{stocker.Name}当前没有可用的站台可以放货,任务:{task.Id}", LogLevel.Warning);
                                        return(BllResultFactory.Error());
                                    }
                                    else
                                    {
                                        return(SendTaskToStation(stocker, plc, task, TaskEntityStatus.发堆垛机库外放货, SRMForkTaskFlag.库外放货, station, task.TaskStatus));
                                    }
                                }
                                else if (task.TaskType == TaskType.整盘入库.GetIndexInt() || task.TaskType == TaskType.空容器入库.GetIndexInt())
                                {
                                    //整盘入库、空盘入库:当前目的货位与堆垛机是否在同一个巷道,在,则下发库内放货任务;不在,报错;
                                    var tempLocation = locationsRoadWay.FirstOrDefault(t => t.Code == task.ToLocationCode);
                                    if (tempLocation != null)
                                    {
                                        //同一个巷道,则直接下发库内放货
                                        return(SendTaskToLocation(stocker, plc, task, tempLocation, TaskEntityStatus.发堆垛机库内放货, SRMForkTaskFlag.库内放货, task.TaskStatus));
                                    }
                                    else
                                    {
                                        Logger.Log($"任务:{task.Id}对应去向货位{task.ToLocationCode}不在本巷道中,请检查任务数据", LogLevel.Error);
                                        return(BllResultFactory.Error());
                                    }
                                }
                                else if (task.TaskType == TaskType.出库查看.GetIndexInt() || task.TaskType == TaskType.分拣出库.GetIndexInt() || task.TaskType == TaskType.盘点.GetIndexInt() || task.TaskType == TaskType.补充入库.GetIndexInt())
                                {
                                    //补充入库、分拣出库、盘点、出库查看:需要判断任务阶段来决定是出还是入
                                    //判断任务阶段
                                    if (task.Stage == TaskStageFlag.入.GetIndexInt())
                                    {
                                        //判断目标货位是否在当前巷道
                                        var tempLocation = locationsRoadWay.FirstOrDefault(t => t.Code == task.ToLocationCode);
                                        if (tempLocation != null)
                                        {
                                            //同一个巷道,则直接下发库内放货
                                            return(SendTaskToLocation(stocker, plc, task, tempLocation, TaskEntityStatus.发堆垛机库内放货, SRMForkTaskFlag.库内放货, task.TaskStatus));
                                        }
                                        else
                                        {
                                            Logger.Log($"任务:{task.Id}对应去向货位{task.ToLocationCode}不在本巷道中,请检查任务数据", LogLevel.Error);
                                            return(BllResultFactory.Error());
                                        }
                                    }
                                    else
                                    {
                                        //出
                                        var stationsResult = AppSession.ExcuteService.GetOutStationByPort(stocker.DestinationArea, taskForResend.ToPort, App.WarehouseCode);
                                        if (!stationsResult.Success)
                                        {
                                            return(BllResultFactory.Error(stationsResult.Msg));
                                        }
                                        var station = stationsResult.Data.Where(t => availableStation.Count(a => a.Code == t.Code) > 0).OrderBy(t => CurrentColumn - t.ColumnIndex).FirstOrDefault();
                                        if (station == null)
                                        {
                                            Logger.Log($"堆垛机{stocker.Name}当前没有可用的站台可以放货,任务:{task.Id}", LogLevel.Warning);
                                            return(BllResultFactory.Error());
                                        }
                                        else
                                        {
                                            return(SendTaskToStation(stocker, plc, task, TaskEntityStatus.发堆垛机库外放货, SRMForkTaskFlag.库外放货, station, task.TaskStatus));
                                        }
                                    }
                                }
                                else
                                {
                                    //报警,未知的任务类型
                                    Logger.Log($"堆垛机{stocker.Name}对应的任务{task.Id}为未知的任务类型", LogLevel.Error);
                                    return(BllResultFactory.Error());
                                }
                            }
                        }
                        else
                        {
                            //无货,说明完全处在空闲状态
                            var tempTasks = tasks;
                            if (tempTasks.Count == 0)
                            {
                                return(BllResultFactory.Error());
                            }
                            else
                            {
                                //完全空闲的堆垛机实际只执行取货任务,则为库外取与库内取两种
                                //找出下发状态的待取的离堆垛机最近的任务,并且对应站台口需要可用
                                var task1s = tempTasks.Where(t => t.TaskStatus == TaskEntityStatus.发任务.GetIndexInt() && (t.TaskType == TaskType.出库查看.GetIndexInt() || t.TaskType == TaskType.分拣出库.GetIndexInt() || t.TaskType == TaskType.整盘出库.GetIndexInt() || t.TaskType == TaskType.盘点.GetIndexInt() || t.TaskType == TaskType.空容器出库.GetIndexInt() || t.TaskType == TaskType.补充入库.GetIndexInt() || t.TaskType == TaskType.移库.GetIndexInt()) && locationsRoadWay.Exists(a => a.Code == t.FromLocationCode)).ToList();
                                task1s.ForEach(t =>
                                {
                                    t.FromLocation    = locationsRoadWay.First(a => a.Code == t.FromLocationCode);
                                    t.ToPortEquipment = tempEquipments.FirstOrDefault(a => a.Code == t.ToPort);
                                });
                                //任务过滤条件,任务port对应的station要可用
                                task1s = task1s.Where(t => availableStation.Exists(a => AppSession.ExcuteService.GetOutStationByPort(stocker.DestinationArea, t.ToPort, App.WarehouseCode).Data?.Exists(b => b.Code == a.Code) == true)).ToList();

                                //库内取货的任务
                                var task1 = task1s.OrderByDescending(t => t.Priority).ThenBy(t => Math.Abs((int)t.FromLocation.Line - CurrentColumn)).FirstOrDefault();

                                //本巷道接入口的任务
                                var task2 = tempTasks.Where(t => t.TaskStatus == TaskEntityStatus.响应接入站台到达.GetIndexInt() && tempEquipments.Exists(a => a.Code == t.Gateway)).OrderByDescending(t => t.Priority).ThenBy(t => Math.Abs((int)t.FromLocation.Line - CurrentColumn)).FirstOrDefault();
                                if (task1 == null && task2 == null)
                                {
                                    //说明当前没有可以被执行的任务
                                    return(BllResultFactory.Error());
                                }
                                if (task1 == null)
                                {
                                    //说明库外取货任务不为空,则下发接入任务
                                    return(SendTaskToStation(stocker, plc, task2, TaskEntityStatus.发堆垛机库外取货, SRMForkTaskFlag.库外取货, tempEquipments.First(t => t.Code == task2.Gateway), task2.TaskStatus));
                                }
                                if (task2 == null)
                                {
                                    //说明库内取货任务不为空
                                    return(SendTaskToLocation(stocker, plc, task1, task1.FromLocation, TaskEntityStatus.发堆垛机库内取货, SRMForkTaskFlag.库内取货, task1.TaskStatus));
                                }

                                //当两种任务均存在时,此处设置两种模式,出库优先与均衡模式(按堆垛机位置进行)
                                var configResult = AppSession.BllService.GetAllConfig();
                                var config       = configResult.Data?.FirstOrDefault(t => t.Code == ConfigStrings.OutFirst.ToString());
                                if (config == null || config.Value != "1")
                                {
                                    //均衡模式
                                    var dis1 = Math.Abs((int)task1.FromLocation.Line - CurrentColumn);
                                    var dis2 = Math.Abs(task2.ArrivaEquipment.RowIndex1 - CurrentColumn);
                                    if (dis1 <= dis2)
                                    {
                                        return(SendTaskToLocation(stocker, plc, task1, task1.FromLocation, TaskEntityStatus.发堆垛机库内取货, SRMForkTaskFlag.库内取货, task1.TaskStatus));
                                    }
                                    else
                                    {
                                        return(SendTaskToStation(stocker, plc, task2, TaskEntityStatus.发堆垛机库外取货, SRMForkTaskFlag.库外取货, tempEquipments.First(t => t.Code == task2.Gateway), task2.TaskStatus));
                                    }
                                }
                                else
                                {
                                    //出库优先模式
                                    return(SendTaskToLocation(stocker, plc, task1, task1.FromLocation, TaskEntityStatus.发堆垛机库内取货, SRMForkTaskFlag.库内取货, task1.TaskStatus));
                                }
                            }
                        }
                    }
                    else if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == "WCSFork1TaskFlag").Value == SRMForkTaskFlag.除任务.GetIndexString())
                    {
                        return(ClearWCSData(stocker, plc));
                    }
                    else
                    {
                        //hack:其他情况1-库内取货,2-库内放货,3-库外入库,4库外出库, 5重新分配入库地址,暂时不做处理,这里也应不需要处理这些情况
                    }
                }
                else if (stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskExcuteStatus.ToString()).Value == SRMTaskExcuteStatus.任务完成.GetIndexString() && stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.WCSFork1TaskFlag.ToString()).Value != SRMForkTaskFlag.任务完成.GetIndexString())
                {
                    //一共4种完成情况
                    //根据任务号和货叉类型进行任务完成处理
                    int taskNo     = int.Parse(stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskNo.ToString()).Value);
                    int forkType   = int.Parse(stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskType.ToString()).Value);
                    var taskResult = AppSession.Dal.GetCommonModelByCondition <TaskEntity>($"where id = {taskNo}");
                    if (!taskResult.Success)
                    {
                        Logger.Log($"根据堆垛机任务号{taskNo}未找到任务:{taskResult.Msg}", LogLevel.Error);
                        return(BllResultFactory.Error());
                    }
                    var task        = taskResult.Data[0];
                    var tempStatus  = task.TaskStatus;
                    var tempGateWay = task.Gateway;
                    //库内取货完成
                    if (forkType == SRMForkTaskFlag.库内取货.GetIndexInt())
                    {
                        //更新任务状态
                        task.TaskStatus = TaskEntityStatus.响应堆垛机库内取货完成.GetIndexInt();
                        task.Gateway    = stocker.Code;
                        var tempResult = AppSession.Dal.UpdateCommonModel <TaskEntity>(task);
                        if (tempResult.Success)
                        {
                            //标记交换区地址,任务完成10
                            var prop = stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.WCSFork1TaskFlag.ToString());
                            prop.Value = SRMForkTaskFlag.任务完成.GetIndexString();
                            var sendResult = plc.Writes(new List <EquipmentProp> {
                                prop
                            });
                            if (sendResult.Success)
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库内取货成功,任务:{task.Id}", LogLevel.Success);
                                return(BllResultFactory.Sucess());
                            }
                            else
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库内取货失败,任务:{task.Id},原因:{sendResult.Msg}", LogLevel.Error);
                                task.TaskStatus = tempStatus;
                                task.Gateway    = tempGateWay;
                                AppSession.Dal.UpdateCommonModel <TaskEntity>(task);
                                return(BllResultFactory.Error());
                            }
                        }
                        else
                        {
                            Logger.Log($"完成堆垛机{stocker.Name}库内取货时,更新任务{task.Id}状态失败:{tempResult.Msg}", LogLevel.Error);
                            return(BllResultFactory.Error($"完成堆垛机{stocker.Name}库内取货时,更新任务{task.Id}状态失败:{tempResult.Msg}"));
                        }
                    }

                    //库内放货完成
                    else if (forkType == SRMForkTaskFlag.库内放货.GetIndexInt())
                    {
                        //本地完成任务,然后进行回传
                        var tempResult = AppSession.TaskService.CompleteTask(task.Id.Value, App.User.UserCode);
                        if (!tempResult.Success)
                        {
                            Logger.Log($"完成堆垛机{stocker.Name}库内放货失败:{tempResult.Msg}", LogLevel.Error);
                            return(BllResultFactory.Error($"完成堆垛机{stocker.Name}库内放货失败:{tempResult.Msg}"));
                        }
                        else
                        {
                            //标记交换区地址,任务完成10
                            var prop = stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.WCSFork1TaskFlag.ToString());
                            prop.Value = SRMForkTaskFlag.任务完成.GetIndexString();
                            var sendResult = plc.Writes(new List <EquipmentProp> {
                                prop
                            });
                            if (sendResult.Success)
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库内放货成功,任务:{task.Id}", LogLevel.Success);
                                return(BllResultFactory.Sucess());
                            }
                            else
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库内放货失败,请人工处理任务:{task.Id},原因:{sendResult.Msg}", LogLevel.Error);
                                return(BllResultFactory.Error());
                            }
                        }
                    }
                    //库外取货完成时
                    else if (forkType == SRMForkTaskFlag.库外取货.GetIndexInt())
                    {
                        //更新任务状态
                        task.TaskStatus = TaskEntityStatus.响应堆垛机库外取货完成.GetIndexInt();
                        task.Gateway    = stocker.Code;
                        var tempResult = AppSession.Dal.UpdateCommonModel <TaskEntity>(task);
                        if (tempResult.Success)
                        {
                            //标记交换区地址,任务完成10
                            var prop = stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.WCSFork1TaskFlag.ToString());
                            prop.Value = SRMForkTaskFlag.任务完成.GetIndexString();
                            var sendResult = plc.Writes(new List <EquipmentProp> {
                                prop
                            });
                            if (sendResult.Success)
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库外取货成功,任务:{task.Id}", LogLevel.Success);
                                return(BllResultFactory.Sucess());
                            }
                            else
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库外取货失败,任务:{task.Id},原因:{sendResult.Msg}", LogLevel.Error);
                                task.TaskStatus = tempStatus;
                                task.Gateway    = tempGateWay;
                                AppSession.Dal.UpdateCommonModel <TaskEntity>(task);
                                return(BllResultFactory.Error());
                            }
                        }
                        else
                        {
                            Logger.Log($"完成堆垛机{stocker.Name}库外取货时,更新任务{task.Id}状态失败:{tempResult.Msg}", LogLevel.Error);
                            return(BllResultFactory.Error($"完成堆垛机{stocker.Name}库外取货时,更新任务{task.Id}状态失败:{tempResult.Msg}"));
                        }
                    }
                    //库外放货完成时
                    else if (forkType == SRMForkTaskFlag.库外放货.GetIndexInt())
                    {
                        //库外放货时,堆垛机会携带站台Index,找到放货站台并更新到任务;
                        var currentStation = stocker.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == SRMProps.CurrentStation.ToString());
                        if (currentStation == null)
                        {
                            Logger.Log($"未找到堆垛机{stocker.Name}对应的出入口属性", LogLevel.Error);
                            return(BllResultFactory.Error());
                        }
                        var station = tempEquipments.FirstOrDefault(t => t.StationIndex?.ToString() == currentStation.Value);
                        if (station == null)
                        {
                            Logger.Log($"未找到堆垛机{stocker.Name}对应的出入口{currentStation.Value}", LogLevel.Error);
                            return(BllResultFactory.Error());
                        }

                        //更新任务状态
                        task.TaskStatus = TaskEntityStatus.响应堆垛机库外放货完成.GetIndexInt();
                        //注意此处对应放货的具体接出站台
                        task.Gateway = station.Code;
                        var tempResult = AppSession.Dal.UpdateCommonModel <TaskEntity>(task);
                        if (tempResult.Success)
                        {
                            //标记交换区地址,任务完成10
                            var prop = stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.WCSFork1TaskFlag.ToString());
                            prop.Value = SRMForkTaskFlag.任务完成.GetIndexString();
                            var sendResult = plc.Writes(new List <EquipmentProp> {
                                prop
                            });
                            if (sendResult.Success)
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库外放货成功,任务:{task.Id}", LogLevel.Success);
                                return(BllResultFactory.Sucess());
                            }
                            else
                            {
                                Logger.Log($"堆垛机{stocker.Name}完成库外放货失败,任务:{task.Id},原因:{sendResult.Msg}", LogLevel.Error);
                                task.TaskStatus = tempStatus;
                                task.Gateway    = tempGateWay;
                                AppSession.Dal.UpdateCommonModel <TaskEntity>(task);
                                return(BllResultFactory.Error());
                            }
                        }
                        else
                        {
                            Logger.Log($"完成堆垛机{stocker.Name}库外放货时,更新任务{task.Id}状态失败:{tempResult.Msg}", LogLevel.Error);
                            return(BllResultFactory.Error($"完成堆垛机{stocker.Name}库外放货时,更新任务{task.Id}状态失败:{tempResult.Msg}"));
                        }
                    }
                    return(BllResultFactory.Sucess());
                }
                else
                {
                    //未知情况
                    Logger.Log($"堆垛机{stocker.Name}出现了未知的执行状态:{stocker.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == SRMProps.Fork1TaskExcuteStatus.ToString()).Value}", LogLevel.Warning);
                    return(BllResultFactory.Sucess());
                }
            }
            return(BllResultFactory.Sucess());
        }
 private void equipmentTable_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.selectedEquipment = (Equipment)equipmentTable.SelectedItem;
     e.Handled = true;
 }
예제 #41
0
    private static void ItemChange(Creature p, Equipment item)
    {
        int choice;

        do
        {
            Console.Clear();
            Utilities.ColourText(Colour.ENHANCEMENT, "Available Enhancements\n");
            for (int i = 0; i < CraftMachineEnhancements.Count; i++)
            {
                //List each enhancement, under it the items required to craft
                if (item.isWeapon == false && CraftMachineEnhancements[i].name == "Deadly")
                {
                    Utilities.EmbedColourText(Colour.MITIGATION, $"\n[{i + 1}] ", $"Hardened", "");
                }
                else
                {
                    Utilities.EmbedColourText(Colour.magicColour[(int)CraftMachineEnhancements[i].type + 1], $"\n[{i + 1}] ", $"{CraftMachineEnhancements[i].name}", "");
                }
                if (CraftMachineEnhancements[i].ingredient1Amount > 0)
                {
                    Utilities.ColourText(Colour.DROP, $"{CraftMachineEnhancements[i].ingredient1Amount} {CraftMachineEnhancements[i].ingredient1.name}\n");
                }
                if (CraftMachineEnhancements[i].ingredient2Amount > 0)
                {
                    Utilities.ColourText(Colour.DROP, $"{CraftMachineEnhancements[i].ingredient2Amount} {CraftMachineEnhancements[i].ingredient2.name}\n");
                }
                if (CraftMachineEnhancements[i].ingredient3Amount > 0)
                {
                    Utilities.ColourText(Colour.DROP, $"{CraftMachineEnhancements[i].ingredient3Amount} {CraftMachineEnhancements[i].ingredient3.name}\n");
                }
                if (CraftMachineEnhancements[i].ingredient4Amount > 0)
                {
                    Utilities.ColourText(Colour.DROP, $"{CraftMachineEnhancements[i].ingredient4Amount} {CraftMachineEnhancements[i].ingredient4.name}\n");
                }
            }
            Console.WriteLine("\n\n[0] Return \n");
            //Select your enhancement
        } while (!int.TryParse(Console.ReadLine(), out choice));
        if (choice > 0 && choice < CraftMachineEnhancements.Count + 1)
        {
            if (IngredientCheck(p, CraftMachineEnhancements[choice - 1]))
            {
                Console.Clear();
                Console.Write("\n");
                Utilities.DotDotDotSL();
                string weapOrArm = (item.isWeapon == true) ? "weapon" : "armor";
                string col       = (item.isWeapon == true) ? Colour.DAMAGE : Colour.MITIGATION;
                Utilities.EmbedColourText(col, Colour.ITEM, " Success! \n\nYou managed to ", "enhance", " your ", weapOrArm, "\n\n");
                //Add the prefix to the item info
                if (item.isWeapon == false && CraftMachineEnhancements[choice - 1].name == "Deadly")
                {
                    item.preName      = "Hardened";
                    item.frontEnhance = 5;
                }
                else
                {
                    item.preName      = CraftMachineEnhancements[choice - 1].name;
                    item.frontEnhance = choice;
                }
                //Actually affect the item
                if (CraftMachineEnhancements[choice - 1].type == EnhancementType.DAMAGE)
                {
                    string damOrMit = (item.isWeapon == true) ? "Damage" : "Mitigation";
                    Utilities.EmbedColourText(col, col, "", damOrMit, " increased by ", $"{CraftMachineEnhancements[choice - 1].effect}", "");
                    item.damageEffect += CraftMachineEnhancements[choice - 1].effect;
                    item.goldEffect    = item.xpEffect = item.healthEffect = 0;
                    p.health           = (p.health > p.maxHealth) ? p.maxHealth : p.health;
                }
                if (CraftMachineEnhancements[choice - 1].type == EnhancementType.HEALTH)
                {
                    Utilities.EmbedColourText(Colour.magicColour[(int)CraftMachineEnhancements[choice].type], Colour.magicColour[(int)CraftMachineEnhancements[choice].type], "", "Health", " increased by ", $"{CraftMachineEnhancements[choice - 1].effect}", "");
                    item.healthEffect += CraftMachineEnhancements[choice - 1].effect;
                    p.health          += CraftMachineEnhancements[choice - 1].effect;
                    item.damageEffect  = item.xpEffect = item.goldEffect = 0;
                }
                if (CraftMachineEnhancements[choice - 1].type == EnhancementType.GOLD)
                {
                    Utilities.EmbedColourText(Colour.magicColour[(int)CraftMachineEnhancements[choice].type], Colour.magicColour[(int)CraftMachineEnhancements[choice].type], "", "Gold drop", " increased by ", $"{CraftMachineEnhancements[choice - 1].effect}", "");
                    item.goldEffect   = CraftMachineEnhancements[choice - 1].effect;
                    item.damageEffect = item.xpEffect = item.healthEffect = 0;
                    p.health          = (p.health > p.maxHealth) ? p.maxHealth : p.health;
                }
                if (CraftMachineEnhancements[choice - 1].type == EnhancementType.XP)
                {
                    Utilities.EmbedColourText(Colour.magicColour[(int)CraftMachineEnhancements[choice].type], Colour.magicColour[(int)CraftMachineEnhancements[choice].type], "", "Experience gained", "increased by ", $"{CraftMachineEnhancements[choice - 1].effect}", "");
                    item.xpEffect     = CraftMachineEnhancements[choice - 1].effect;
                    item.damageEffect = item.goldEffect = item.healthEffect = 0;
                    p.health          = (p.health > p.maxHealth) ? p.maxHealth : p.health;
                }
            }
            else
            {
                Console.WriteLine("\nYou do not have the ingredients required");
            }
            Utilities.Keypress();
        }
    }
예제 #42
0
 public Order(Equipment equipment)
 {
     Equipment = equipment;
 }
예제 #43
0
    public void Equip(Equipment newItem)
    {
        Equipment oldItem = null;

        int slotIndex = (int)newItem.equipSlot;

        if (currentEquipment[slotIndex] != null)
        {
            oldItem = currentEquipment[slotIndex];
            if (oldItem != unarmed)
            {
                inventory.Add(oldItem);
            }

            if (oldItem.isSetItem)
            {
                if (itemSets.ContainsKey(oldItem.setPartOf))
                {
                    itemSets[oldItem.setPartOf]--;

                    foreach (SetBonus bonus in oldItem.setPartOf.setBonuses)
                    {
                        if (itemSets[oldItem.setPartOf] < bonus.numSetItemsReq && setBonusEffects.ContainsKey(bonus))
                        {
                            foreach (SetBonusEffect effect in setBonusEffects[bonus])
                            {
                                effect.RemoveAndDestroySetBonus();
                            }
                            setBonusEffects.Remove(bonus);
                        }
                    }

                    if (itemSets[oldItem.setPartOf] == 0)
                    {
                        itemSets.Remove(oldItem.setPartOf);
                    }
                }
            }
        }

        if (onEquipmentChanged != null)
        {
            onEquipmentChanged.Invoke(newItem, oldItem);
        }

        if (newItem.equipSlot == EquipmentSlot.Weapon)
        {
            if ((newItem as Weapon).isTwoHanded)
            {
                Unequip((int)EquipmentSlot.Shield);
            }

            PutWeaponInHand(newItem as Weapon);
            OnWeaponChanged(newItem as Weapon);
        }

        if (newItem.equipSlot == EquipmentSlot.Shield && currentEquipment[(int)EquipmentSlot.Weapon] != null && (currentEquipment[(int)EquipmentSlot.Weapon] as Weapon).isTwoHanded)
        {
            Unequip((int)EquipmentSlot.Weapon);
        }

        if (newItem.isSetItem)
        {
            if (itemSets.ContainsKey(newItem.setPartOf))
            {
                itemSets[newItem.setPartOf]++;
            }
            else
            {
                itemSets.Add(newItem.setPartOf, 1);
            }

            foreach (SetBonus bonus in newItem.setPartOf.setBonuses)
            {
                if (itemSets[newItem.setPartOf] >= bonus.numSetItemsReq && !setBonusEffects.ContainsKey(bonus))
                {
                    setBonusEffects.Add(bonus, new List <SetBonusEffect>());
                    foreach (SetBonusEffectConfig effect in bonus.setBonusEffects)
                    {
                        SetBonusEffect effectInstance = (SetBonusEffect)effect.AttachEffectTo(gameObject);
                        effectInstance.MyStats    = playerStats;
                        effectInstance.TheirStats = playerStats;
                        setBonusEffects[bonus].Add(effectInstance);
                    }
                }
            }
        }

        if (newItem.equipSlot == EquipmentSlot.Shield)
        {
            shieldModel.SetActive(true);
        }

        inventory.PlayLootSound(newItem, true);
        currentEquipment[slotIndex] = newItem;
    }
예제 #44
0
    public void LoadSavedEquipment(Equipment[] loadedEquipment)
    {
        foreach (Equipment newItem in loadedEquipment)
        {
            if (newItem != null)
            {
                Equipment oldItem = null;

                int slotIndex = (int)newItem.equipSlot;

                if (currentEquipment[slotIndex] != null)
                {
                    oldItem = currentEquipment[slotIndex];
                }

                if (onEquipmentChanged != null)
                {
                    onEquipmentChanged.Invoke(newItem, oldItem);
                }

                if (newItem.equipSlot == EquipmentSlot.Weapon)
                {
                    PutWeaponInHand(newItem as Weapon);
                    OnWeaponChanged(newItem as Weapon);
                }

                if (newItem.equipSlot == EquipmentSlot.Shield)
                {
                    shieldModel.SetActive(true);
                }

                if (newItem.isSetItem)
                {
                    if (itemSets.ContainsKey(newItem.setPartOf))
                    {
                        itemSets[newItem.setPartOf]++;
                    }
                    else
                    {
                        itemSets.Add(newItem.setPartOf, 1);
                    }

                    foreach (SetBonus bonus in newItem.setPartOf.setBonuses)
                    {
                        if (itemSets[newItem.setPartOf] >= bonus.numSetItemsReq && !setBonusEffects.ContainsKey(bonus))
                        {
                            setBonusEffects.Add(bonus, new List <SetBonusEffect>());
                            foreach (SetBonusEffectConfig effect in bonus.setBonusEffects)
                            {
                                SetBonusEffect effectInstance = (SetBonusEffect)effect.AttachEffectTo(gameObject);
                                effectInstance.MyStats    = playerStats;
                                effectInstance.TheirStats = playerStats;
                                setBonusEffects[bonus].Add(effectInstance);
                            }
                        }
                    }
                }

                currentEquipment[slotIndex] = newItem;
            }
        }
    }
예제 #45
0
 /// <summary>
 /// 更换装备.
 /// </summary>
 public void ChangeEquipment(int pEquipPos, Equipment pEquip)
 {
     UnWearEquipment(pEquipPos);
     WearEquipment(pEquipPos, pEquip);
 }
예제 #46
0
    //Called when equipping any piece of equipment.
    public void EquipItem(Equipment equipment)
    {
        if (equipment == null)
        {
            return;
        }

        switch (equipment.slot)
        {
        case EquipmentSlots.Weapon:
            UnequipItem(weapon);
            break;

        case EquipmentSlots.Head:
            UnequipItem(headEquipment);
            break;

        case EquipmentSlots.Chest:
            UnequipItem(chestEquipment);
            break;

        case EquipmentSlots.Legs:
            UnequipItem(legEquipment);
            break;

        default:
            print("Applicable equipment slot not found!");
            break;
        }

        foreach (Attack primary in equipment.primaryAttacks)
        {
            primaryAttacks.Add(primary);
        }

        foreach (Attack counter in equipment.counterAttacks)
        {
            counterAttacks.Add(counter);
        }

        health     += equipment.health;
        attack     += equipment.atk;
        defence    += equipment.def;
        magic      += equipment.mag;
        resistance += equipment.res;
        movement   += equipment.mov;
        accuracy   += equipment.accuracy;
        foreach (KeyValuePair <ElementalTypes, double> element in equipment.elementalResists)
        {
            //For added security, in the case that a new type of element resist is added? Probably unnecessary

            /*if(!elementResists.ContainsKey(element.Key))
             * {
             *  elementResists.Add(element.Key, element.Value);
             * }
             * else
             * {
             *  elementResists[element.Key] += element.Value;
             * }*/
            elementResists[element.Key] += element.Value;
        }
    }
예제 #47
0
        public int WhiteImbue(Equipment Item, ref ImbueStat stat, ImbueItem imbueitem)
        {
            int value = (int)(Item.RequiredLevel);

            value += (int)(((value * 0.1) * Item.Slvl) + ((imbueitem.ImbueChance / 5) * Item.Slvl));

            List <ImbueStat> WhiteStats = new List <ImbueStat>();

            WhiteStats.Add(ImbueStat.Damage);
            WhiteStats.Add(ImbueStat.Defense);
            WhiteStats.Add(ImbueStat.AttackRating);
            WhiteStats.Add(ImbueStat.MaxLife);
            WhiteStats.Add(ImbueStat.MaxMana);
            WhiteStats.Add(ImbueStat.LifeReg);
            WhiteStats.Add(ImbueStat.ManaReg);
            WhiteStats.Add(ImbueStat.CriticalHit);

            if (Item is Cape)
            {
                WhiteStats.Remove(ImbueStat.Damage);
                WhiteStats.Remove(ImbueStat.Defense);
            }
            if (Item is Hand)
            {
                Hand weapon = Item as Hand;
                WhiteStats.Remove(weapon.NotWithWhite);
            }
            if (Item is Head)
            {
                Head hat = Item as Head;
                WhiteStats.Remove(hat.NotWithWhite);
            }
            if (Item is Body)
            {
                Body armor = Item as Body;
                WhiteStats.Remove(armor.NotWithWhite);
            }
            if (Item is Ring)
            {
                Ring ring = Item as Ring;
                value *= (int)2.94;
            }
            if (Item is Necklace)
            {
                Necklace neck = Item as Necklace;
                value *= (int)1.85;
            }

            if (imbueitem.ImbueData == 0)
            {
                int randomStat = Random.Next(0, WhiteStats.Count);
                stat = WhiteStats[randomStat];
            }
            else
            {
                switch (imbueitem.ImbueData)
                {
                case 2:
                    stat = ImbueStat.Damage;
                    break;

                case 3:
                    stat = ImbueStat.Defense;
                    break;

                case 4:
                    stat = ImbueStat.AttackRating;
                    break;

                case 5:
                    stat = ImbueStat.CriticalHit;
                    break;

                case 6:
                    stat = ImbueStat.MaxLife;
                    break;

                case 7:
                    stat = ImbueStat.MaxMana;
                    break;

                case 8:
                    stat = ImbueStat.LifeReg;
                    break;

                case 9:
                    stat = ImbueStat.ManaReg;
                    break;

                default:
                    stat = ImbueStat.CriticalHit;
                    break;
                }
            }
            switch (stat)
            {
            case ImbueStat.Damage:
                Item.Damage += (short)value;
                break;

            case ImbueStat.Defense:
                Item.Defence += (short)value;
                break;

            case ImbueStat.AttackRating:
                Item.AttackRating += (short)value;
                break;

            case ImbueStat.MaxLife:
                Item.IncMaxLife += (short)value;
                break;

            case ImbueStat.MaxMana:
                Item.IncMaxMana += (short)value;
                break;

            case ImbueStat.LifeReg:
                Item.IncLifeRegen += (short)value;
                break;

            case ImbueStat.ManaReg:
                Item.IncManaRegen += (short)value;
                break;

            case ImbueStat.CriticalHit:
                value          = (int)(Math.Round((double)(value / 50))) + 1;
                Item.Critical += (short)value;
                break;
            }

            return(value);
        }
예제 #48
0
        /// <summary>
        /// 执行下料请求
        /// 注意:allEquipments引用所有设备,此为共享应用
        /// </summary>
        /// <param name="lengthMeasuring"></param>
        /// <param name="allEquipments"></param>
        /// <param name="plc"></param>
        /// <returns></returns>
        public override BllResult ExcuteRequest(Equipment lengthMeasuringMachine, List <Equipment> allEquipments, List <StepTrace> stepTraceList, IPLC plc)
        {
            try
            {
                //接收PLC传来的长度
                var pipeLength          = lengthMeasuringMachine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.RequestLength.ToString());
                var lengthConvertResult = int.TryParse(pipeLength.Value, out int length);
                //接收PLC传来的材质
                var pipeMaterial          = lengthMeasuringMachine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.RequestMaterial.ToString());
                var materialConvertResult = int.TryParse(pipeMaterial.Value, out int materialType);
                //接收PLC传来的壁厚
                var pipeThickness          = lengthMeasuringMachine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.RequestThickness.ToString());
                var thicknessConvertResult = decimal.TryParse(pipeThickness.Value, out decimal thickness);
                //接收PLC传来的内径
                var pipeDiameter          = lengthMeasuringMachine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.RequestDiameter.ToString());
                var diameterConvertResult = decimal.TryParse(pipeDiameter.Value, out decimal diameter);

                if (!lengthConvertResult)
                {
                    Logger.Log($"处理站台[{lengthMeasuringMachine.StationId}]的设备[{lengthMeasuringMachine.Name}]下料请求失败,原材料的长度[{pipeLength.Value}]转化为整数失败!", LogLevel.Error);
                    return(BllResultFactory.Error());
                }
                if (!materialConvertResult)
                {
                    Logger.Log($"处理站台[{lengthMeasuringMachine.StationId}]的设备[{lengthMeasuringMachine.Name}]下料请求失败,原材料的材质[{pipeMaterial.Value}]转化为整数失败!", LogLevel.Error);
                    return(BllResultFactory.Error());
                }
                if (!thicknessConvertResult)
                {
                    Logger.Log($"处理站台[{lengthMeasuringMachine.StationId}]的设备[{lengthMeasuringMachine.Name}]下料请求失败,原材料的壁厚[{pipeThickness.Value}]转化为整数失败!", LogLevel.Error);
                    return(BllResultFactory.Error());
                }
                if (!diameterConvertResult)
                {
                    Logger.Log($"处理站台[{lengthMeasuringMachine.StationId}]的设备[{lengthMeasuringMachine.Name}]下料请求失败,原材料的内径[{pipeDiameter.Value}]转化为整数失败!", LogLevel.Error);
                    return(BllResultFactory.Error());
                }

                var nextEquipment = allEquipments.FirstOrDefault(t => t.SelfAddress == lengthMeasuringMachine.GoAddress.ToString());

                //对缓存表做判断,小于12条记录说明缓存区没满,可以下料
                var cacheInfo = AppSession.Dal.GetCommonModelByConditionWithZero <StationCache>($" where  stationCode = '{nextEquipment.StationCode}' and status < {StationCacheStatus.使用中.GetIndexInt()}");
                if (!cacheInfo.Success)
                {
                    Logger.Log($"处理站台[{lengthMeasuringMachine.StationId}]的设备[{lengthMeasuringMachine.Name}]下料请求失败,查询缓存区失败,原因:[{cacheInfo.Msg}]", LogLevel.Error);
                    return(BllResultFactory.Error());
                }
                if (cacheInfo.Data.Count >= 11)
                {
                    Logger.Log($"处理站台[{lengthMeasuringMachine.StationId}]的设备[{lengthMeasuringMachine.Name}]下料请求失败,缓存区已满,请等待缓存区腾出位置", LogLevel.Warning);
                    return(BllResultFactory.Error());
                }
                var requestNumber = lengthMeasuringMachine.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == MachineProps.RequestNumber.ToString());

                //生成缓存记录并且插入数据库
                StationCache stationCache = new StationCache();
                stationCache.StationId      = lengthMeasuringMachine.StationId;
                stationCache.StationCode    = lengthMeasuringMachine.StationCode;
                stationCache.WcsProductType = materialType;
                stationCache.Thickness      = thickness / 10;
                stationCache.Diameter       = diameter / 10;
                stationCache.MaterialLength = length;
                stationCache.Status         = StationCacheStatus.初始.GetIndexInt();
                stationCache.CreateBy       = App.User.UserCode;
                stationCache.CreateTime     = DateTime.Now;
                var insertResult = AppSession.Dal.InsertCommonModel <StationCache>(stationCache);
                if (!insertResult.Success)
                {
                    Logger.Log($"处理工位[{lengthMeasuringMachine.StationCode}]的设备[{lengthMeasuringMachine.Name}] 下料请求的时候,插入管材信息到数据库失败,原因:{insertResult.Msg}", LogLevel.Error);
                    return(BllResultFactory.Error());
                }
                stationCache.Id = insertResult.Data;
                var sendResult = SendAddressReplyToPlc(lengthMeasuringMachine, plc, MachineMessageFlag.WCS回复允许下料, requestNumber.Value, stationCache.Id.ToString(), "", "0", stationCache.WcsProductType.ToString(), stationCache.MaterialLength.ToString(), stationCache.Diameter.ToString(), stationCache.Thickness.ToString(), lengthMeasuringMachine.GoAddress);
                if (sendResult.Success)
                {
                    Logger.Log($"处理工位[{lengthMeasuringMachine.StationCode}]的设备[{lengthMeasuringMachine.Name}] 下料请求 成功,管子缓存标识[{stationCache.Id}],管子材质[{stationCache.WcsProductType}],管子长度[{stationCache.MaterialLength}],管子直径[{stationCache.Diameter}],管子壁厚[{stationCache.Thickness}]", LogLevel.Success);
                    return(BllResultFactory.Sucess());
                }
                else
                {
                    AppSession.Dal.DeleteCommonModelByIds <StationCache>(new List <int>()
                    {
                        stationCache.Id.Value
                    });
                    Logger.Log($"处理工位[{lengthMeasuringMachine.StationCode}]的设备[{lengthMeasuringMachine.Name}] 下料请求的时候,管子缓存标识[{stationCache.Id}]对应的信息写入PLC失败,原因:{sendResult.Msg}", LogLevel.Error);
                    return(BllResultFactory.Error());
                }
            }
            catch (Exception ex)
            {
                Logger.Log($"处理站台[{lengthMeasuringMachine.StationId}]的设备[{lengthMeasuringMachine.Name}]下料请求时候,发生异常:{ex.Message}", LogLevel.Exception, ex);
                return(BllResultFactory.Error());
            }
        }
예제 #49
0
        public async Task <ActionResult <Equipment> > PostEquipment([FromRoute] int clinicId, [FromBody] Equipment equipment)
        {
            if (clinicId != equipment.ClinicId)
            {
                LoggerService.GetInstance.CreateLog($"[PostEquipment: {clinicId}] The criteria did not match.");

                return(BadRequest());
            }

            var result = await _equipment.CreateEquipmentAsync(clinicId, equipment);

            if (result == null)
            {
                LoggerService.GetInstance.CreateLog($"[PostEquipment: {clinicId}] The clinic not found.");

                return(NotFound());
            }

            LoggerService.GetInstance.CreateLog($"[PostEquipment: {clinicId}] The post process has completed successfully.");

            return(result);
        }
예제 #50
0
 void ApplyModifier(Equipment e, EquipmentModifier mod)
 {
     // Apply stats
     // Chang name
 }
예제 #51
0
        private void OnFirstUpdate()
        {
            var stance = this.ActorModel.EquipmentModel.GetStanceType();

            var equipmentType = this.ActorModel.EquipmentModel.EquipmentType.ToString();

            var possibleWeaponType = equipmentType.Split('_');

            object[] parameters = null;

            switch (stance)
            {
            case EquipmentModel.StanceTypes.Fists:
                parameters = new object[]
                {
                    LeftHand,
                    RightHand,
                };
                break;

            case EquipmentModel.StanceTypes.SingleHanded:
                parameters = new object[]
                {
                    LeftHand,
                    RightHand,
                    null,
                    RightHandWeapon,
                };
                break;

            case EquipmentModel.StanceTypes.DualHanded:
                parameters = new object[]
                {
                    LeftHand,
                    RightHand,
                    LeftHandWeapon,
                    RightHandWeapon,
                };
                break;

            case EquipmentModel.StanceTypes.BothHands:
                parameters = new object[]
                {
                    LeftHand,
                    RightHand,
                    LeftHandWeapon,
                };
                break;

            default:
                break;
            }

            Type t = null;

            foreach (var value in possibleWeaponType)
            {
                t = Type.GetType("Flounchy.Equipments." + value);

                if (t != null)
                {
                    continue;
                }
            }

            if (t == null)
            {
                throw new Exception("Setup isn't complete for: " + equipmentType);
            }

            this._equipment = (Equipments.Equipment)Activator.CreateInstance(t, parameters);

            this._equipment.SetStance(this.Position);
            this._equipment.SetEquipmentRotation();

            _onFirstUpdate = null;
        }
예제 #52
0
 public void EditEquipment(Equipment equipment)
 {
     throw new NotImplementedException();
 }
예제 #53
0
        public Equipment GetEquipmentById(int id)
        {
            Equipment equipment = this.equipmentRepository.GetById(id);

            return(equipment);
        }
예제 #54
0
 public void NewEquipment(Equipment equipment)
 {
     equipmentService.NewEquipment(equipment);
 }
예제 #55
0
 /// <summary>
 /// Проверяет возможность установки предмета в указанный слот экипировки.
 /// Используется в this[].set.
 /// </summary>
 /// <param name="equipment">Предмет, который будет экипирован.</param>
 /// <param name="slotIndex">Слот, в который будет произведена экипировка.</param>
 /// <remarks>
 /// При нарушении условий будет выбрасывать исключение.
 /// </remarks>
 protected abstract void ValidateSetEquipment(Equipment equipment, int slotIndex);
예제 #56
0
 public void DeleteEquipment(Equipment equipment)
 {
     throw new NotImplementedException();
 }
예제 #57
0
 public void equipItem(int i, Equipment eq)
 {
     equipmentGUI.equipItem(i, eq);
 }
예제 #58
0
 protected override IEnumerable <MatcherData> CreateCollection() =>
 new ConditionMatcherCollection(_modifierBuilder)
 {
     // actions
     // - generic
     { "on ({ActionMatchers})", Reference.AsAction.On() },
     { "if you've ({ActionMatchers}) recently", Reference.AsAction.Recently },
     { "if you haven't ({ActionMatchers}) recently", Not(Reference.AsAction.Recently) },
     {
         "when you ({ActionMatchers}) a rare or unique enemy",
         And(Reference.AsAction.Against(Enemy).On(), Enemy.IsRareOrUnique)
     },
     // - kill
     { "on ({KeywordMatchers}) kill", Kill.On(Reference.AsKeyword) },
     { "when you kill an enemy,", Kill.Against(Enemy).On() },
     {
         "if you've killed a maimed enemy recently",
         And(Kill.Against(Enemy).Recently, Buff.Maim.IsOn(Enemy))
     },
     {
         "if you've killed a bleeding enemy recently",
         And(Kill.Against(Enemy).Recently, Ailment.Bleed.IsOn(Enemy))
     },
     {
         "if you've killed a cursed enemy recently",
         And(Kill.Against(Enemy).Recently, Buffs(target: Enemy).With(Keyword.Curse).Any())
     },
     {
         "if you or your totems have killed recently",
         Or(Kill.Recently, Kill.By(Entity.Totem).Recently)
     },
     { "if you or your totems kill an enemy", Or(Kill.On(), Kill.By(Entity.Totem).On()) },
     // - block
     { "when they block", Block.On() },
     { "when you block", Block.On() },
     {
         "if you've blocked a hit from a unique enemy recently",
         And(Block.Against(Enemy).Recently, Enemy.IsUnique)
     },
     // - hit
     { "(from|with) hits", Hit.On() },
     { "hits deal", Hit.On() },
     { "when you are hit", Hit.Taken.On() },
     { "if you've been hit recently", Hit.Taken.Recently },
     { "if you haven't been hit recently", Not(Hit.Taken.Recently) },
     { "if you were damaged by a hit recently", Hit.Taken.Recently },
     { "if you've taken no damage from hits recently", Not(Hit.Taken.Recently) },
     // - other
     { "if you've taken a savage hit recently", Action.SavageHit.Taken.Recently },
     { "when you deal a critical strike", CriticalStrike.On() },
     { "if you've crit in the past # seconds", CriticalStrike.InPastXSeconds(Value) },
     { "if you've shattered an enemy recently", Action.Shatter.Against(Enemy).Recently },
     { "when you stun an enemy", Effect.Stun.On() },
     { "after spending # mana", Action.SpendMana(Value).On() },
     { "if you have consumed a corpse recently", Action.ConsumeCorpse.Recently },
     { "when you gain a ({ChargeTypeMatchers})", Reference.AsChargeType.GainAction.On() },
     // damage
     // - by item tag
     { "with weapons", Damage.With(Tags.Weapon) },
     { "weapon", Damage.With(Tags.Weapon) },
     { "with bows", Damage.With(Tags.Bow) },
     { "bow", Damage.With(Tags.Bow) },
     { "with swords", Damage.With(Tags.Sword) },
     { "with claws", Damage.With(Tags.Claw) },
     { "claw", Damage.With(Tags.Claw) },
     { "with daggers", Damage.With(Tags.Dagger) },
     { "with wands", Damage.With(Tags.Wand) },
     { "wand", Damage.With(Tags.Wand) },
     { "with axes", Damage.With(Tags.Axe) },
     { "with staves", Damage.With(Tags.Staff) },
     { "with maces", Or(Damage.With(Tags.Mace), Damage.With(Tags.Sceptre)) },
     { "with one handed weapons", Damage.With(Tags.OneHandWeapon) },
     {
         "with one handed melee weapons",
         And(Damage.With(Tags.OneHandWeapon), Not(Damage.With(Tags.Ranged)))
     },
     { "with two handed weapons", Damage.With(Tags.TwoHandWeapon) },
     {
         "with two handed melee weapons",
         And(Damage.With(Tags.TwoHandWeapon), Not(Damage.With(Tags.Ranged)))
     },
     // - by item slot
     { "with the main-hand weapon", Damage.With(ItemSlot.MainHand) },
     { "with main hand", Damage.With(ItemSlot.MainHand) },
     { "with off hand", Damage.With(ItemSlot.OffHand) },
     // - by source
     { "attacks have", Damage.With(Source.Attack) },
     { "with attacks", Damage.With(Source.Attack) },
     { "from damage over time", Damage.With(Source.DamageOverTime) },
     // - by ailment
     { "with ({AilmentMatchers})", Damage.With(Reference.AsAilment) },
     { "with ailments", Ailment.All.Any(Damage.With) },
     // action and damage combinations
     // - by item tag
     { "if you get a critical strike with a bow", And(CriticalStrike.On(), Damage.With(Tags.Bow)) },
     { "if you get a critical strike with a staff", And(CriticalStrike.On(), Damage.With(Tags.Staff)) },
     { "critical strikes with daggers have a", And(CriticalStrike.On(), Damage.With(Tags.Dagger)) },
     // - by item slot
     // - by source
     { "for each enemy hit by your attacks", And(Hit.Against(Enemy).On(), Damage.With(Source.Attack)) },
     // - by ailment
     { "with hits and ailments", Or(Hit.On(), Ailment.All.Any(Damage.With)) },
     {
         "poison you inflict with critical strikes deals",
         And(Damage.With(Ailment.Poison), CriticalStrike.On())
     },
     // equipment
     { "while unarmed", Not(MainHand.HasItem) },
     { "while wielding a staff", MainHand.Has(Tags.Staff) },
     { "while wielding a dagger", MainHand.Has(Tags.Dagger) },
     { "while wielding a bow", MainHand.Has(Tags.Bow) },
     { "while wielding a sword", MainHand.Has(Tags.Sword) },
     { "while wielding a claw", MainHand.Has(Tags.Claw) },
     { "while wielding an axe", MainHand.Has(Tags.Axe) },
     { "while wielding a mace", Or(MainHand.Has(Tags.Mace), MainHand.Has(Tags.Sceptre)) },
     { "while wielding a melee weapon", And(MainHand.Has(Tags.Weapon), Not(MainHand.Has(Tags.Ranged))) },
     { "while wielding a one handed weapon", MainHand.Has(Tags.OneHandWeapon) },
     { "while wielding a two handed weapon", MainHand.Has(Tags.TwoHandWeapon) },
     { "while dual wielding", OffHand.Has(Tags.Weapon) },
     { "while holding a shield", OffHand.Has(Tags.Shield) },
     { "while dual wielding or holding a shield", Or(OffHand.Has(Tags.Weapon), OffHand.Has(Tags.Shield)) },
     { "with shields", OffHand.Has(Tags.Shield) },
     { "from equipped shield", And(Condition.BaseValueComesFrom(OffHand), OffHand.Has(Tags.Shield)) },
     { "with # corrupted items equipped", Equipment.Count(e => e.IsCorrupted) >= Value },
     // stats
     // - pool
     { "when on low life", Life.IsLow },
     { "when not on low life", Not(Life.IsLow) },
     { "while no mana is reserved", Mana.Reservation.Value == 0 },
     { "while energy shield is full", EnergyShield.IsFull },
     { "while on full energy shield", EnergyShield.IsFull },
     { "while not on full energy shield", Not(EnergyShield.IsFull) },
     { "if energy shield recharge has started recently", EnergyShield.Recharge.StartedRecently },
     // - charges
     { "while you have no ({ChargeTypeMatchers})", Reference.AsChargeType.Amount.Value == 0 },
     {
         "while (at maximum|on full) ({ChargeTypeMatchers})",
         Reference.AsChargeType.Amount.Value == Reference.AsChargeType.Amount.Maximum.Value
     },
     // - flags
     { "while you have ({FlagMatchers})", Reference.AsFlagStat.IsSet },
     { "during onslaught", Flag.Onslaught.IsSet },
     { "while phasing", Flag.Phasing.IsSet },
     // - other
     { "if you have # primordial jewels,", Stat.PrimordialJewelsSocketed.Value >= Value },
     // - on enemy
     { "(against enemies )?that are on low life", Enemy.Stat(Life).IsLow },
     { "(against enemies )?that are on full life", Enemy.Stat(Life).IsFull },
     { "against rare and unique enemies", Enemy.IsRareOrUnique },
     // buffs
     { "while you have fortify", Buff.Fortify.IsOn(Self) },
     { "if you've taunted an enemy recently", Buff.Taunt.Action.Recently },
     { "enemies you taunt( deal| take)?", And(For(Enemy), Buff.Taunt.IsOn(Enemy)) },
     { "enemies you curse (take|have)", And(For(Enemy), Buffs(Self, Enemy).With(Keyword.Curse).Any()) },
     { "(against|from) blinded enemies", Buff.Blind.IsOn(Enemy) },
     { "from taunted enemies", Buff.Taunt.IsOn(Enemy) },
     {
         "you and allies affected by your auras have",
         Or(For(Entity.ModifierSource), And(For(Ally), Buffs(target: Ally).With(Keyword.Aura).Any()))
     },
     {
         "you and allies deal while affected by auras you cast",
         Or(For(Entity.ModifierSource), And(For(Ally), Buffs(target: Ally).With(Keyword.Aura).Any()))
     },
     // buff and damage combinations
     {
         "bleeding you inflict on maimed enemies deals",
         And(Damage.With(Ailment.Bleed), Buff.Maim.IsOn(Enemy))
     },
     // ailments
     { "while ({AilmentMatchers})", Reference.AsAilment.IsOn(Self) },
     { "(against|from) ({AilmentMatchers}) enemies", Reference.AsAilment.IsOn(Enemy) },
     {
         "against frozen, shocked or ignited enemies",
         Or(Ailment.Freeze.IsOn(Enemy), Ailment.Shock.IsOn(Enemy), Ailment.Ignite.IsOn(Enemy))
     },
     { "enemies which are ({AilmentMatchers})", Reference.AsAilment.IsOn(Enemy) },
     {
         "against enemies( that are)? affected by elemental ailments",
         Ailment.Elemental.Any(a => a.IsOn(Enemy))
     },
     {
         "against enemies( that are)? affected by no elemental ailments",
         Not(Ailment.Elemental.Any(a => a.IsOn(Enemy)))
     },
     // ground effects
     { "while on consecrated ground", Ground.Consecrated.IsOn(Self) },
     // other effects
     { "against burning enemies", Fire.DamageOverTimeIsOn(Enemy) },
     // skills
     // - by keyword
     { "vaal( skill)?", With(Skills[Keyword.Vaal]) },
     { "({KeywordMatchers})", With(Skills[Reference.AsKeyword]) },
     {
         "({KeywordMatchers}) and ({KeywordMatchers})",
         Or(With(Skills[References[0].AsKeyword]), With(Skills[References[1].AsKeyword]))
     },
     { "(with|of|for|from) ({KeywordMatchers})( skills)?", With(Skills[Reference.AsKeyword]) },
     { "({KeywordMatchers}) skills (have|deal)", With(Skills[Reference.AsKeyword]) },
     // - by damage type
     { "with ({DamageTypeMatchers}) skills", With(Skills[Reference.AsDamageType]) },
     // - by item slot
     { "skills (in|from) your ({ItemSlotMatchers})(can have| have)?", With(Skills[Reference.AsItemSlot]) },
     // - by single skill
     { "({SkillMatchers})('|s)?( fires| has a| have a| has| deals| gain)?", With(Reference.AsSkill) },
     { "(dealt by) ({SkillMatchers})", With(Reference.AsSkill) },
     // - cast recently/in past x seconds
     { "if you've cast a spell recently", Skills[Keyword.Spell].Cast.Recently },
     { "if you've attacked recently", Skills[Keyword.Attack].Cast.Recently },
     { "if you've used a movement skill recently", Skills[Keyword.Movement].Cast.Recently },
     { "if you've used a warcry recently", Skills[Keyword.Warcry].Cast.Recently },
     {
         "if you've used a ({DamageTypeMatchers}) skill in the past # seconds",
         Skills[Reference.AsDamageType].Cast.InPastXSeconds(Value)
     },
     // skill and action combinations
     {
         "projectiles have against targets they pierce",
         And(Projectile.Pierce.On(), With(Skills[Keyword.Projectile]))
     },
     // traps and mines
     { "with traps", With(Traps) },
     { "with mines", With(Mines) },
     { "traps and mines (deal|have a)", Or(With(Traps), With(Mines)) },
     { "from traps and mines", Or(With(Traps), With(Mines)) },
     { "for throwing traps", With(Traps) },
     { "if you detonated mines recently", Skill.DetonateMines.Cast.Recently },
     { "if you've placed a mine or thrown a trap recently", Or(Traps.Cast.Recently, Mines.Cast.Recently) },
     // totems
     { "totems", For(Entity.Totem) },
     { "totems (fire|gain|have)", With(Totems) },
     { "(spells cast|attacks used|skills used) by totems (have a|have)", With(Totems) },
     { "of totem skills that cast an aura", With(Skills[Keyword.Totem, Keyword.Aura]) },
     { "while you have a totem", Totems.Any(s => s.HasInstance) },
     { "if you've summoned a totem recently", Totems.Cast.Recently },
     { "when you place a totem", Totems.Cast.On() },
     // minions
     { "minions", For(Entity.Minion) },
     { "minions (deal|have|gain)", For(Entity.Minion) },
     { "you and your minions have", For(Entity.Minion, Entity.ModifierSource) },
     { "golem", For(Entity.Minion.With(Keyword.Golem)) },
     { "golems have", For(Entity.Minion.With(Keyword.Golem)) },
     { "spectres have", For(Entity.Minion.From(Skill.RaiseSpectre)) },
     {
         // Technically this would be separate for each minion summoned by that skill, but DPS will
         // only be calculated for a single minion anyway.
         "golems summoned in the past # seconds deal",
         With(Golems.Where(s => s.Cast.InPastXSeconds(Value)))
     },
     { "if you Summoned a golem in the past # seconds", Golems.Cast.InPastXSeconds(Value) },
     // flasks
     { "while using a flask", Flask.IsAnyActive },
     { "during any flask effect", Flask.IsAnyActive },
     // other
     { "while leeching", Condition.WhileLeeching },
     { "(you )?gain", Condition.True },     // may be left over at the end, does nothing
     // unique
     {
         "when your trap is triggered by an enemy",
         Condition.Unique("When your Trap is triggered by an Enemy")
     },
     {
         "when your mine is detonated targeting an enemy",
         Condition.Unique("When your Mine is detonated targeting an Enemy")
     },
     {
         "if you've killed an enemy affected by your damage over time recently",
         Condition.Unique("Have you recently killed an Enemy affected by your Damage over Time?")
     },
 };
예제 #59
0
 public async Task <OutputEquipment> OutputFor(Equipment equipment, CancellationToken token = default)
 {
     return(await Create(equipment, _outputFlags, token));
 }
예제 #60
0
 void Start()
 {
     equipment = GetComponent <Equipment> ();
 }