public Item(string name, int attack, int defense, SlotType slotType, bool lightsource)
 {
     this.Name = name;
     this.Attack = attack;
     this.Defense = defense;
     this.itemSlotType = slotType;
     this.lightSource = lightsource;
 }
Exemple #2
0
 public AssociationType(string type, string source, string target, string id, SlotType[] slots)
 {
     this.Type = type;
     this.SourceObject = source;
     this.TargetObject = target;
     this.Id = id;
     if (slots != null) this.Slot = slots;
 }
 public EncounterSlot(EncounterSlot template)
 {
     Species = template.Species;
     AllowDexNav = template.AllowDexNav;
     LevelMax = template.LevelMax;
     LevelMin = template.LevelMin;
     Type = template.Type;
     Pressure = template.Pressure;
 }
 public EquipmentSlot(int id, StringName sn, ItemClass[] itemClass, SlotType slot)
 {
     _id = id;
     _displayedName = sn;
     _allowedItemType = new ItemClass[itemClass.GetLength(0)];
     _allowedItemType = itemClass;
     _item = null;
     _fullInfo = "-";
     _slotType = slot;
 }
Exemple #5
0
	public Item GetItem (SlotType slot)
	{
		if (slot != SlotType.None)
		{
			int index = (int)slot - 1;
			
			if (items != null && index < items.Length)
			{
				return items[index];
			}
		}
		return null;
	}
	public Transform GetSlot(SlotType type, int index, int wagonIndex = 0)
	{
		switch (type) {
		case SlotType.Equipment:
			{return equipmentUI.slots [index].slot;}
		case SlotType.Wagon:
			{return wagonUIs[wagonIndex].slots [index];}
		case SlotType.Shop:
			{return shopInventory.slots [index];}
		}
		Debug.Log ("GetSlot Broken!");
		return null;
	}
Exemple #7
0
	protected Item (Item other)
	{
		this.id = other.id;
		this.ItemName = other.ItemName;
		this.Stackable = other.Stackable;
		this.MaxStack = other.MaxStack;
		this.Type = other.Type;
		this.ItemGameObject = other.ItemGameObject;
		this.Atlas = other.Atlas;
		this.ItemSprite = other.ItemSprite;
		this.Description = other.Description;
		this.Slot = other.Slot;

	}
Exemple #8
0
        /// <summary>
        /// Create a new slot
        /// </summary>
        /// <param name="gc">Owning graph controller</param>
        /// <param name="type">Input/Output slot</param>
        /// <param name="firstOwner">Node where there slot resides</param>
        internal Slot(IGraphController gc, SlotType type, IVisualNode firstOwner)
        {
            if (gc == null || firstOwner == null)
                throw new ArgumentNullException();

            this.graphController = gc as GraphController;
            Validity.Assert(this.graphController != null);
            IdGenerator idGenerator = this.graphController.GetIdGenerator();

            this.slotType = type;
            this.version = Slot.Version.Current;
            this.slotId = idGenerator.GetNextId(ComponentType.Slot);
            this.slotState = SlotStates.Visible;
            this.owners.Add(firstOwner.NodeId);
        }
Exemple #9
0
 public ClassificationType(string cScheme, string cObject, string cNode, string nRepr, string id, string name, SlotType[] slots)
 {
     if (cScheme != null) this.ClassificationScheme = cScheme;
     if (cObject != null) this.ClassifiedObject = cObject;
     if (cNode != null) this.ClassificationNode = cNode;
     if (nRepr != null) this.NodeRepresentation = nRepr;
     if (id != null) this.Id = id;
     if (name != null)
     {
         this.Name = new InternationalStringType();
         this.Name.LocalizedString = new LocalizedStringType[1];
         this.Name.LocalizedString[0] = new LocalizedStringType();
         this.Name.LocalizedString[0].Value = name;
     }
     if (slots != null) this.Slot = slots;
 }
Exemple #10
0
        internal override List<uint> GetSlotIdsByName(SlotType slotType, string variableName)
        {
            if (slotType == SlotType.None)
                throw new InvalidOperationException("'sloType' is None");

            if (slotType == SlotType.Input)
                throw new InvalidOperationException("'sloType' is Input");

            if (slotType == SlotType.Output && variableName == this.Caption)
            {
                List<uint> outputSlotIds = new List<uint>();
                outputSlotIds.Add(outputSlots[0]);
                return outputSlotIds;
            }

            throw new InvalidOperationException("'variableName' is not exist");
        }
Exemple #11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="slotId_"></param>
 /// <param name="node_"></param>
 /// <param name="connectionType_"></param>
 /// <param name="slot_"></param>
 /// <param name="controlType_"></param>
 /// <param name="tag_"></param>
 /// <param name="saveValue_"></param>
 public NodeFunctionSlot(
     int slotId_, 
     SequenceNode node_, 
     SlotType connectionType_, 
     SequenceFunctionSlot slot_,
     VariableControlType controlType_ = VariableControlType.ReadOnly,
     object tag_ = null, 
     bool saveValue_ = true)
     : base(slotId_, 
             node_, 
             slot_.Name,
             connectionType_, 
             slot_.VariableType,
             controlType_,
             tag_, 
             saveValue_)
 {
     m_FuncSlot = slot_;
     m_FuncSlot.PropertyChanged += new PropertyChangedEventHandler(OnFunctionSlotPropertyChanged);
 }
Exemple #12
0
	public bool Equip(Item item, SlotType slot)
	{
		int index = (int)slot - 1;

		if(item == null)
		{
			items[index] = item;
			return true;
		}


		if(item.Slot == slot)
		{
			if(items[index] != null)
				return false;

			items[index] = item;

			return true;
		}

		return false;
	}
 //Drag handeler in the slot
 public void OnBeginDrag(PointerEventData eventData)
 {
     ID = int.Parse(transform.parent.name); //Get the ID of the current dragged item
     //Check if delete key:
     if (Input.GetKey(KeyCode.LeftControl) && Type == SlotType.Craft)
         isSplitting = true;
     else
         isSplitting = false;
     //Get the current item dragged:
     switch(Type)
     {
         case SlotType.Inventory:
             currentItem = Inventory.Items[ID];
             break;
         case SlotType.Craft:
             currentItem = CraftUI.ItemsInCraftTable[ID];
             break;
     }
     itemBeginDragged = gameObject;
     staticType = Type;
     _startPosition = transform.position;
     _startParent = transform.parent;
     GetComponent<CanvasGroup>().blocksRaycasts = false;
 }
Exemple #14
0
        public SlotGeneral(SlotType type, int index, int id)
        {
            Type = type;
            Index = index;
            ConfigID = id;

            Lv = 1;
            Rank = 0;

            // 是否上阵
            ExtraData = 0;

            // 经验值
            ExtraData2 = 0;

            GeneralConfig = DBConfigMgr.Instance.MapGeneral[ConfigID];
        }
 public static string[] GetIndexNames(SlotType typ)
 {
     switch (typ)
     {
         case SlotType.CompVar: return new string[] { "Model", "Texture", "Color", "Highlight Color" };
         case SlotType.Prop: return new string[] { "Model", "Texture", "Color", "Highlight Color" };
         case SlotType.HeadOverlay: return new string[] { "Model", "Opacity", "Color", "Highlight Color" };
         case SlotType.Parent: return new string[] { "Mom", "Dad", "Resemblance", "Skin Tone" };
         default: return new string[] { "Model", "Texture", "Color", "Highlight Color" };
     }
 }
Exemple #16
0
 public static bool AreCompatible(SlotType slot, Item.ItemType item)
 {
     // This is somewhat hacky, but slots are potentially subject to change anyway.
     return(slot == SlotType.General || (int)slot == (int)item || (int)slot > 9);
 }
Exemple #17
0
        public void Serialize()
        {
            // This is the XML Document which we are writing to.
            var doc = new XmlDocument();

            doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
            var root = doc.CreateElement("Object");

            Thread.CurrentThread.CurrentCulture = new CultureInfo(1033);
            var command = doc.CreateComment("Generated on " + DateTime.Today.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString());

            doc.AppendChild(command);

            var objectType = doc.CreateAttribute("type");

            objectType.Value = ObjectType;
            root.Attributes.Append(objectType);

            var objectId = doc.CreateAttribute("id");

            objectId.Value = ObjectId;
            root.Attributes.Append(objectId);

            var @class = doc.CreateElement("Class"); // @class because "class" is a keyword

            @class.InnerText = Class;
            root.AppendChild(@class);

            var isItem = doc.CreateElement("Item");

            root.AppendChild(isItem);

            if (itemCreatorForm.RemoteTexture)
            {
                var remoteTexture = doc.CreateElement("RemoteTexture");
                var rtInstance    = doc.CreateElement("Instance");
                var rtId          = doc.CreateElement("Id");

                rtInstance.InnerText = RemoteTextureInstance;
                rtId.InnerText       = RemoteTextureId;

                remoteTexture.AppendChild(rtInstance);
                remoteTexture.AppendChild(rtId);

                root.AppendChild(remoteTexture);
            }
            else
            {
                var texture = doc.CreateElement("Texture");
                var tFile   = doc.CreateElement("File");
                var tIndex  = doc.CreateElement("Index");

                tFile.InnerText  = TextureFile;
                tIndex.InnerText = TextureIndex;

                texture.AppendChild(tFile);
                texture.AppendChild(tIndex);

                root.AppendChild(texture);
            }

            var slotType = doc.CreateElement("SlotType");

            slotType.InnerText = SlotType.ToString();
            root.AppendChild(slotType);

            var tier = doc.CreateElement("Tier");

            tier.InnerText = Tier == -1 ? "UT" : Tier.ToString();
            root.AppendChild(tier);

            var description = doc.CreateElement("Description");

            description.InnerText = Description;
            root.AppendChild(description);

            var rateOfFire = doc.CreateElement("RateOfFire");

            rateOfFire.InnerText = RateOfFire.ToString();
            root.AppendChild(rateOfFire);

            var sound = doc.CreateElement("sound");

            sound.InnerText = "weapon/blunt_sword";
            root.AppendChild(sound);

            var bagType = doc.CreateElement("BagType");

            bagType.InnerText = BagType.ToString();
            root.AppendChild(bagType);

            var oldSound = doc.CreateElement("OldSound");

            oldSound.InnerText = "bladeSwing";
            root.AppendChild(oldSound);

            var displayId = doc.CreateElement("DisplayId");

            displayId.InnerText = DisplayName;
            root.AppendChild(displayId);

            doc.AppendChild(root);

            var writer = new StringWriter();

            doc.Save(writer);

            var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            var fullFileName  = Path.Combine(desktopFolder, "Generated Item.xml");

            var dlr = MessageBox.Show(writer.ToString(), "Finished XML", MessageBoxButtons.YesNo);

            if (dlr != DialogResult.Yes)
            {
                return;
            }
            MessageBox.Show("Saving generated XML file to \r\n" + fullFileName);
            doc.Save(fullFileName);
        }
Exemple #18
0
 private SlotIndex(InstructionNode index, SlotType slotType)
 {
     Index = index;
     this.slotType = slotType;
 }
Exemple #19
0
 public PrefabInfo(GameObject _icon, SlotType _type)
 {
     icon = _icon;
     type = _type;
 }
 public Slot(int [][] position, SlotType slotType, double cube)
 {
     CubicHeight = cube;
     isEmpty     = Empty();
 }
Exemple #21
0
        internal override string GetSlotName(SlotType slotType, uint slotId)
        {
            if (slotType == SlotType.Input)
            {
                int slotIndex = this.inputSlots.IndexOf(slotId);
                if (slotIndex == -1)
                    throw new InvalidOperationException("'slotId' not in 'inputSlot'");
            }
            else if (slotType == SlotType.Output)
            {
                int slotIndex = this.outputSlots.IndexOf(slotId);
                if (slotIndex == -1)
                    throw new InvalidOperationException("'slotId' not in 'outputSlot'");
            }
            else
                throw new InvalidOperationException("'slotType' is none");

            return this.Text;
        }
Exemple #22
0
        private static IEnumerable <EncounterSlot1> GetSlots1_GW(byte[] data, ref int ofs, SlotType t)
        {
            int rate = data[ofs++];

            return(rate == 0 ? Enumerable.Empty <EncounterSlot1>() : ReadSlots(data, ref ofs, 10, t, rate));
        }
    private void Update()
    {
        if (!isEnabled)
        {
            return;
        }

        if (item_quantity.text.Equals("0") || quantity <= 0)
        {
            Clear();
            return;
        }

        if (Input.touchCount == 0 || (Input.touchCount > 1 && Input.GetTouch(1).phase.Equals(TouchPhase.Ended)))
        {
            if (isMoving)
            {
                isMoving    = false;
                isBeingHeld = false;
                SummonItem(slot_item);
                AudioManager.GetInstance().Play("sfx-drop");
                rect.anchoredPosition = startPoint;

                if (item_quantity.text.Equals("0"))
                {
                    isMoving = false;
                    Clear();
                    InventoryController.GetInventoryController().UpdateUI();

                    return;
                }
            }

            isMoving = false;
            return;
        }

        Vector3 position;

        position = Input.touchCount == 2 ? Input.GetTouch(1).position : Input.GetTouch(0).position;

        //position = Camera.main.ScreenToWorldPoint(position);

        if (interactible_box.OverlapPoint(position) || isMoving)
        {
            if (!isBeingHeld)
            {
                AudioManager.GetInstance().Play("sfx-drag");
                isBeingHeld = true;
                HeldType    = slotType;
            }

            if (!HeldType.Equals(slotType))
            {
                return;
            }

            isMoving = true;
            Vector3 Position = new Vector3(position.x, position.y, 0);
            rect.position = Position;
        }
    }
Exemple #24
0
        private static IEnumerable <EncounterArea> GetAreas2(byte[] data, ref int ofs, SlotType t, int slotSets, int slotCount)
        {
            var areas = new List <EncounterArea>();

            while (data[ofs] != 0xFF) // end
            {
                var location = data[ofs++] << 8 | data[ofs++];
                var slots    = GetSlots2_GW(data, ref ofs, t, slotSets, slotCount);
                var area     = new EncounterArea
                {
                    Location = location,
                    Slots    = slots,
                };
                foreach (var slot in slots)
                {
                    slot.Area = area;
                }
                areas.Add(area);
            }
            ofs++;
            return(areas);
        }
Exemple #25
0
 internal static bool IsFishingRodType(this SlotType t) => (t & (SlotType)0xF) is SlotType.Old_Rod or SlotType.Good_Rod or SlotType.Super_Rod;
Exemple #26
0
 public TestSlot(int slotId, string displayName, SlotType slotType, ShaderStage shaderStage = ShaderStage.Dynamic, bool hidden = false)
     : base(slotId, displayName, displayName, slotType, shaderStage, hidden)
 {
 }
 public SlotKey(XmlTextReader reader)
 {
     typ = (SlotType)Enum.Parse(typeof(SlotType), reader.GetAttribute("slot_type"));
     id = int.Parse(reader.GetAttribute("slot_id"));
 }
Exemple #28
0
 public void ClearSlot(SlotType slot)
 {
     slotItems[(int)slot - 1] = null;
 }
Exemple #29
0
        private static EncounterSlot2[] GetSlots2GrassWater(byte[] data, ref int ofs, SlotType t, int slotSets, int slotCount)
        {
            byte[] rates = new byte[slotSets];
            for (int i = 0; i < rates.Length; i++)
            {
                rates[i] = data[ofs++];
            }

            var slots = EncounterSlot2.ReadSlots(data, ref ofs, slotSets * slotCount, t, rates[0]);

            if (slotSets <= 1)
            {
                return(slots);
            }

            for (int i = 0; i < slotCount; i++)
            {
                slots[i].Time = EncounterTime.Morning;
            }
            for (int r = 1; r < slotSets; r++)
            {
                for (int i = 0; i < slotCount; i++)
                {
                    int index = i + (r * slotCount);
                    slots[index].Rate       = rates[r];
                    slots[index].SlotNumber = i;
                    slots[index].Time       = r == 1 ? EncounterTime.Day : EncounterTime.Night;
                }
            }

            return(slots);
        }
Exemple #30
0
 public TreeEncounterAvailable[] GetTrees(SlotType t) => t == SlotType.Headbutt
     ? TrainerModerateEncounterTree
     : TrainerLowEncounterTree;
 public TestSlot(int slotId, string displayName, SlotType slotType, int priority, ShaderStageCapability stageCapability = ShaderStageCapability.All, bool hidden = false)
     : base(slotId, displayName, displayName, slotType, priority, stageCapability, hidden)
 {
 }
Exemple #32
0
        private static IEnumerable <EncounterSlot> GetSlots3(byte[] data, ref int ofs, int numslots, SlotType t)
        {
            var slots = new List <EncounterSlot>();
            int Ratio = data[ofs];

            //1 byte padding
            if (Ratio > 0)
            {
                ReadInSlots(data, ofs, numslots, t, slots);
            }
            ofs += 2 + (numslots * 4);
            return(slots);
        }
Exemple #33
0
        public bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            if (storage.ReadUnsignedInteger(FieldCode.SlotSignature) != Configurations.SlotSignature)
                throw new InvalidOperationException("Invalid input data {9D939DA2}");

            try
            {
                this.slotType = (SlotType)storage.ReadInteger(FieldCode.SlotType);
                this.version = (Slot.Version)storage.ReadInteger(FieldCode.SlotVersion);
                this.slotId = storage.ReadUnsignedInteger(FieldCode.SlotId);
                this.slotState = (SlotStates)storage.ReadInteger(FieldCode.SlotState);

                int ownersCount = storage.ReadInteger(FieldCode.OwnersCount);
                this.owners.Clear();
                for (int i = 0; i < ownersCount; i++)
                    owners.Add(storage.ReadUnsignedInteger(FieldCode.Owners));

                int connectingSlotsCount = storage.ReadInteger(FieldCode.ConnectingSlotsCount);
                this.connectingSlots.Clear();
                for (int i = 0; i < connectingSlotsCount; i++)
                    connectingSlots.Add(storage.ReadUnsignedInteger(FieldCode.ConnectingSlots));

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Slot deserialization failed.");
                return false;
            }
        }
Exemple #34
0
        /// <summary>
        /// Gets the encounter areas for species with same level range and same slottype at same location
        /// </summary>
        /// <param name="species">List of species that exist in the Area.</param>
        /// <param name="lvls">Paired LevelMins and LevelMaxs of the encounter slots.</param>
        /// <param name="location">Location index of the encounter area.</param>
        /// <param name="t">Encounter slot type of the encounter area.</param>
        /// <returns></returns>
        public static EncounterArea[] GetSimpleEncounterArea(IEnumerable <int> species, int[] lvls, int location, SlotType t)
        {
            var l = new List <EncounterSlot>();

            // levels data not paired
            if ((lvls.Length & 1) == 1)
            {
                return new[] { new EncounterArea {
                                   Location = location, Slots = l.ToArray()
                               } }
            }
            ;

            foreach (var s in species)
            {
                for (int i = 0; i < lvls.Length;)
                {
                    l.Add(new EncounterSlot
                    {
                        LevelMin = lvls[i++],
                        LevelMax = lvls[i++],
                        Species  = s,
                        Type     = t
                    });
                }
            }
            return(new[] { new EncounterArea {
                               Location = location, Slots = l.ToArray()
                           } });
        }
Exemple #35
0
 public static int GetSlot(SlotType type, uint rand, FrameType t) => t switch
 {
Exemple #36
0
        private static IEnumerable <EncounterArea> GetAreas2(byte[] data, ref int ofs, SlotType t, int slotSets, int slotCount)
        {
            var areas = new List <EncounterArea>();

            while (data[ofs] != 0xFF) // end
            {
                areas.Add(new EncounterArea
                {
                    Location  = data[ofs++] << 8 | data[ofs++],
                        Slots = GetSlots2_GW(data, ref ofs, t, slotSets, slotCount),
                });
            }
            ofs++;
            return(areas);
        }
 public MagicItem(string name, List <Modifier> modifier, List <CombatAction> combatActions, double cost, double weight, string description, RarityType rarityType = RarityType.Normal, SlotType slotType = SlotType.None) : base(name, cost, weight, description, rarityType, slotType)
 {
     Modifiers     = modifier;
     CombatActions = combatActions;
 }
Exemple #38
0
        private static IEnumerable <EncounterSlot> GetSlots3(byte[] data, ref int ofs, int numslots, SlotType t)
        {
            var slots = new List <EncounterSlot>();
            int Ratio = data[ofs];

            //1 byte padding
            if (Ratio > 0)
            {
                for (int i = 0; i < numslots; i++)
                {
                    int Species = BitConverter.ToInt16(data, ofs + 4 + i * 4);
                    if (Species <= 0)
                    {
                        continue;
                    }

                    slots.Add(new EncounterSlot
                    {
                        LevelMin   = data[ofs + 2 + i * 4],
                        LevelMax   = data[ofs + 3 + i * 4],
                        Species    = Species,
                        SlotNumber = i,
                        Type       = t
                    });
                }
            }
            ofs += 2 + numslots * 4;
            return(slots);
        }
Exemple #39
0
        public SlotSoldier(SlotType type, int index, int id)
        {
            Type = type;
            Index = index;
            ConfigID = id;

            Lv = 1;
            Rank = 0;
            AddedCount = 0;

            // 绑定的武将
            ExtraData = 0;

            SoldierConfig = DBConfigMgr.Instance.MapSoldier[ConfigID];
        }
 public bool isSameSlot(SlotType slot)
 {
     return _slotType == slot;
 }
    public SlotType typ; // compvar, prop, overlay, ...

    #endregion Fields

    #region Constructors

    public SlotKey(SlotType typ_, int id_)
    {
        typ = typ_;
        id = id_;
    }
Exemple #42
0
 public void ClearSlot(SlotType slot)
 {
     slotItems[(int)slot - 1] = null;
 }
 public static int GetNumId(SlotType typ)
 {
     switch (typ)
     {
         case SlotType.CompVar: return 12;
         case SlotType.Prop: return 8;
         case SlotType.HeadOverlay: return 13;
         default: return 1;
     }
 }
Exemple #44
0
 public Dictionary<int, Slot> GetPlayerBag(SlotType type)
 {
     return playerBags[type];
 }
Exemple #45
0
        private static EncounterSlot[] GetSlots4_DPPt_G(byte[] data, int ofs, int numslots, SlotType t)
        {
            var slots = new EncounterSlot[numslots];

            for (int i = 0; i < numslots; i++)
            {
                int level   = data[ofs + i * 8];
                int species = BitConverter.ToInt32(data, ofs + i * 8 + 4);
                slots[i] = new EncounterSlot
                {
                    LevelMax   = level,
                    LevelMin   = level,
                    Species    = species,
                    SlotNumber = i,
                    Type       = t
                };
            }
            return(slots);
        }
Exemple #46
0
 public int EncounterSlot(SlotType t) => SlotRange.GetSlot(t, ESV, FrameType);
Exemple #47
0
 public void SetItemInSlot(SlotType slot, Item item)
 {
     slotItems[(int)slot - 1] = item;
 }
Exemple #48
0
        private static EncounterSlot[] GetSlots4_HGSS_G(byte[] data, int ofs, int numslots, SlotType t)
        {
            var slots = new EncounterSlot[numslots * 3];

            // First 36 slots are morning, day and night grass slots
            // The order is 12 level values, 12 morning species, 12 day species and 12 night species
            for (int i = 0; i < numslots; i++)
            {
                int level   = data[ofs + i];
                int species = BitConverter.ToUInt16(data, ofs + numslots + i * 2);
                slots[i] = new EncounterSlot
                {
                    LevelMin   = level,
                    LevelMax   = level,
                    Species    = species,
                    SlotNumber = i,
                    Type       = t
                };
                slots[numslots + i]             = slots[i].Clone();
                slots[numslots + i].Species     = BitConverter.ToUInt16(data, ofs + numslots * 3 + i * 2);
                slots[numslots + i].Type        = t;
                slots[numslots * 2 + i]         = slots[i].Clone();
                slots[numslots * 2 + i].Species = BitConverter.ToUInt16(data, ofs + numslots * 5 + i * 2);
                slots[numslots * 2 + i].Type    = t;
            }

            return(slots);
        }
Exemple #49
0
 public Item GetItemInSlot(SlotType fromSlot)
 {
     return slotItems[(int)fromSlot - 1];
 }
Exemple #50
0
        private static IEnumerable <EncounterSlot> GetSlots4_G_Replace(byte[] data, int ofs, int slotSize, EncounterSlot[] ReplacedSlots, int[] slotnums, SlotType t = SlotType.Grass)
        {
            //Special slots like GBA Dual Slot. Those slot only contain the info of species id, the level is copied from one of the first grass slots
            //for dppt slotSize = 4, for hgss slotSize = 2
            var slots = new List <EncounterSlot>();

            int numslots = slotnums.Length;

            for (int i = 0; i < numslots; i++)
            {
                var baseSlot = ReplacedSlots[slotnums[i]];
                if (baseSlot.LevelMin <= 0)
                {
                    continue;
                }

                int species = BitConverter.ToUInt16(data, ofs + i / (4 / slotSize) * slotSize);
                if (species <= 0 || baseSlot.Species == species) // Empty or duplicate
                {
                    continue;
                }

                var slot = baseSlot.Clone();
                slot.Species = species;
                slot.Type    = t;
                slots.Add(slot);
            }
            return(slots);
        }
Exemple #51
0
        public void SetQueue(ClientQueue qBase, SlotType type, bool utcOffsetIsZero)
        {
            if (qBase != null)
             {
            _queue = qBase;
            _slotType = type;
            _utcOffsetIsZero = utcOffsetIsZero;

            cboQueueIndex.SelectedIndexChanged -= cboQueueIndex_SelectedIndexChanged;
            cboQueueIndex.DataSource = _queue.EntryNameCollection;
            cboQueueIndex.DisplayMember = "DisplayMember";
            cboQueueIndex.ValueMember = "ValueMember";
            cboQueueIndex.SelectedIndex = -1;
            cboQueueIndex.SelectedIndexChanged += cboQueueIndex_SelectedIndexChanged;

            cboQueueIndex.SelectedValue = _queue.CurrentIndex;
             }
             else
             {
            _queue = null;
            _slotType = SlotType.Unknown;
            _utcOffsetIsZero = false;
            SetControlsVisible(false);
             }
        }
Exemple #52
0
 public void SetItemInSlot(SlotType slot, Item item)
 {
     slotItems[(int)slot - 1] = item;
 }
Exemple #53
0
        private static IEnumerable <EncounterSlot> GetSlots4HGSS_WFR(byte[] data, int ofs, int numslots, SlotType t)
        {
            var slots = new List <EncounterSlot>();

            for (int i = 0; i < numslots; i++)
            {
                // min, max, [16bit species]
                int Species = BitConverter.ToInt16(data, ofs + 2 + i * 4);
                if (t == SlotType.Rock_Smash && Species <= 0)
                {
                    continue;
                }
                // fishing and surf slots with species = 0 are added too, it is needed for the swarm encounters,
                // it will be deleted after add swarm slots

                slots.Add(new EncounterSlot
                {
                    LevelMin = data[ofs + 0 + i * 4],
                    LevelMax = data[ofs + 1 + i * 4],
                    Species  = Species,
                    Type     = t
                });
            }
            return(slots);
        }
Exemple #54
0
        private static EncounterSlot1[] GetSlots1_GW(byte[] data, ref int ofs, SlotType t)
        {
            int rate = data[ofs++];

            return(rate == 0 ? new EncounterSlot1[0] : ReadSlots(data, ref ofs, 10, t, rate));
        }
Exemple #55
0
 public Item(string[] data)
 {
     int col = 0;
     foreach (string s in data)
     {
         switch (col)
         {
             case 0: 
                 {
                     _name = s;
                     break;
                 }
             case 1: 
                 {
                     _weight = Convert.ToInt16(s);
                     break;
                 }
             case 2: 
                 {
                     _value = Convert.ToInt16(s);
                     break;
                 }
             case 3: 
                 {
                     _visual = Convert.ToChar(s);
                     break;
                 }
             case 4: 
                 {
                     _color = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), s);
                     break;
                 }
             case 5: 
                 {
                     _durability = new Stat(Convert.ToInt16(s));
                     break;
                 }
             case 6:
                 {
                     _Desc = (StringName)Enum.Parse(typeof(StringName), s);
                     break;
                 }
             case 7:
                 {
                     _itemClass = (ItemClass)Enum.Parse(typeof(ItemClass), s);
                     break;
                 }
             case 8:
                 {
                     _slot = (SlotType)Enum.Parse(typeof(SlotType), s);
                     break;
                 }
         }
         col++;
     }
     //set posx and posy to 0
     _posX = 0;
     _oldX = 0;
     _posY = 0;
     _oldY = 0;
     _isPassable = true;
     _blockVision = false;
     _type = ObjectType.O_ITEM;
     _seen = false;
 }
Exemple #56
0
        /// <summary>
        /// RBY Format Slot Getter from data.
        /// </summary>
        /// <param name="data">Byte array containing complete slot data table.</param>
        /// <param name="ofs">Offset to start reading from.</param>
        /// <param name="count">Amount of slots to read.</param>
        /// <param name="t">Type of encounter slot.</param>
        /// <param name="rate">Slot type encounter rate.</param>
        /// <returns>Array of encounter slots.</returns>
        private static EncounterSlot1[] ReadSlots(byte[] data, ref int ofs, int count, SlotType t, int rate)
        {
            EncounterSlot1[] slots = new EncounterSlot1[count];
            for (int i = 0; i < count; i++)
            {
                int lvl  = data[ofs++];
                int spec = data[ofs++];

                slots[i] = new EncounterSlot1
                {
                    LevelMax   = t == SlotType.Surf ? lvl + 4 : lvl,
                    LevelMin   = lvl,
                    Species    = spec,
                    Type       = t,
                    Rate       = rate,
                    SlotNumber = i,
                };
            }
            return(slots);
        }
Exemple #57
0
        /// <summary>
        /// 检查插槽错误
        /// </summary>
        /// <param name="meshFile">文件路径</param>
        /// <param name="slotType">插槽类型</param>
        /// <returns>是否有错</returns>
        private bool CheckSlotError(string meshFile, SlotType slotType)
        {
            bool slotError = false;
            string[] sections = meshFile.Split(new char[] { '\\' });
            string itemNumber = sections[sections.Length - 1].Replace(".Mesh", "").Replace(".mesh", "");
            DataRow[] rows = itemForInsertTable.Select(string.Format("ItemNumber = '{0}'", itemNumber));

            if (rows.Length > 0)
            {
                DataRow row = rows[0];
                string leftHandPriorty = row["S_LH_MeshFile"] as string;
                string rightHandPriorty = row["S_RH_MeshFile"] as string;

                switch (slotType)
                {
                    case SlotType.LeftHand:
                        {
                            if (string.IsNullOrEmpty(leftHandPriorty) || leftHandPriorty == "0")
                            {
                                slotError = true;
                            }

                            break;
                        }
                    case SlotType.RightHand:
                        {
                            if (string.IsNullOrEmpty(rightHandPriorty) || rightHandPriorty == "0")
                            {
                                slotError = true;
                            }

                            break;
                        }
                }
            }            

            return slotError;
        }
Exemple #58
0
        private static EncounterSlot1[] ReadSlots_FY(byte[] data, ref int ofs, int count, SlotType t, int rate)
        {
            // Convert byte to actual number
            int[] Levelbytelist = { 0xFF, 0x15, 0x67, 0x1D, 0x3B, 0x5C, 0x72, 0x16, 0x71, 0x18, 0x00, 0x6D, 0x80, };
            int[] dexbytelist   = { 0x47, 0x6E, 0x18, 0x9B, 0x17, 0x4E, 0x8A, 0x5C, 0x5D, 0x9D, 0x9E, 0x1B, 0x85, 0x16, 0x58, 0x59, };
            int[] specieslist   = { 060, 061, 072, 073, 090, 098, 099, 116, 117, 118, 119, 120, 129, 130, 147, 148, };

            EncounterSlot1[] slots = new EncounterSlot1[count];
            for (int i = 0; i < count; i++)
            {
                int spec = specieslist[Array.IndexOf(dexbytelist, data[ofs++])];
                int lvl  = Array.IndexOf(Levelbytelist, data[ofs++]) * 5;

                slots[i] = new EncounterSlot1
                {
                    LevelMax   = lvl,
                    LevelMin   = lvl,
                    Species    = spec,
                    Type       = t,
                    Rate       = rate,
                    SlotNumber = i,
                };
            }
            return(slots);
        }
Exemple #59
0
        private static IEnumerable <EncounterSlot> GetSlots4DPPt_WFR(byte[] data, int ofs, int numslots, SlotType t)
        {
            var slots = new List <EncounterSlot>();

            for (int i = 0; i < numslots; i++)
            {
                // max, min, unused, unused, [32bit species]
                int Species = BitConverter.ToInt32(data, ofs + 4 + i * 8);
                if (Species <= 0)
                {
                    continue;
                }
                // fishing and surf slots with species = 0 are not added
                // DPPt does not have fishing or surf swarms
                slots.Add(new EncounterSlot
                {
                    LevelMax = data[ofs + 0 + i * 8],
                    LevelMin = data[ofs + 1 + i * 8],
                    Species  = Species,
                    Type     = t
                });
            }
            return(slots);
        }
 public SCInvenExpandedPacket(SlotType slotType, byte numSlots) : base(SCOffsets.SCInvenExpandedPacket, 5)
 {
     _slotType = (byte)slotType;
     _numSlots = numSlots;
 }