public void Update() { if (Menu.SelfRevive && LocalPlayer.IsInWorld) { if (LocalPlayer.Stats && LocalPlayer.Stats.Dead) { Item item = ItemDatabase.ItemByName("meds"); ItemUtils.ApplyEffectsToStats(item._usedStatEffect, true, 1); if (item._usedSFX != Item.SFXCommands.None) { LocalPlayer.Inventory.SendMessage(item._usedSFX.ToString()); } LocalPlayer.Stats.HealedMp(); } } if (UnityEngine.Input.GetKey(KeyCode.F6) && LocalPlayer.IsInWorld) { if (LocalPlayer.Stats && LocalPlayer.Stats.Dead) { Item item = ItemDatabase.ItemByName("meds"); ItemUtils.ApplyEffectsToStats(item._usedStatEffect, true, 1); if (item._usedSFX != Item.SFXCommands.None) { LocalPlayer.Inventory.SendMessage(item._usedSFX.ToString()); } LocalPlayer.Stats.HealedMp(); } } }
public IDataItem Next() { if (_allFiles == null || _allFiles.Length == 0 || _allFiles.Length == _currentPosition) { return(null); } var file = _allFiles[_currentPosition]; _currentPosition++; var dir = Path.GetDirectoryName(file); var name = Path.GetFileName(file); var relative = _rootPath.Length == dir.Length ? string.Empty : dir.Substring(_rootPath.Length); if (file.EndsWith(_formatter.FileExtension)) { var item = new RainbowDataItem( _rootPath, relative, name, _formatter); if (item.HasItem) { return(item); } return(Next()); } return(ItemUtils.GetFileSystemDataItem(_rootPath, new FileInfo(file))); }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { // load config this.Config = this.Helper.ReadConfig <ModConfig>(); if (!Enum.TryParse(this.Config.KeyBind, true, out this.MenuKey)) { this.MenuKey = Keys.PageDown; this.Monitor.Log("404 Not Found: Error parsing key binding. Defaulted to Page Down"); } this.Unfiltered = !this.Config.InternetFilter; // load textures try { this.Websites = helper.Content.Load <Texture2D>("assets/websites.png"); } catch (Exception ex) { this.Monitor.Log($"400 Bad Request: Could not load image content. {ex}", LogLevel.Error); } // load utils this.ItemUtils = new ItemUtils(helper.Content, this.Monitor); // hook events ControlEvents.KeyReleased += this.ControlEvents_OnKeyReleased; }
private void WriteItems() { if (_settings.LogicMode == LogicMode.Vanilla) { WriteFreeItem(Items.MaskDeku); if (_settings.ShortenCutscenes) { //giants cs were removed WriteFreeItem(Items.SongOath); } return; } //write free item (start item default = Deku Mask) var freeItemIndex = _randomized.ItemList.FindIndex(u => u.ReplacesItemId == Items.MaskDeku); WriteFreeItem(_randomized.ItemList[freeItemIndex].ID); //write everything else ItemSwapUtils.ReplaceGetItemTable(Values.ModsDirectory); ItemSwapUtils.InitItems(); for (int i = 0; i < _randomized.ItemList.Count; i++) { var itemId = _randomized.ItemList[i].ID; // Unused item if (_randomized.ItemList[i].ReplacesItemId == -1) { continue; } ; bool isRepeatable = Items.REPEATABLE.Contains(itemId); bool isCycleRepeatable = Items.CYCLE_REPEATABLE.Contains(itemId); int replacesItemId = _randomized.ItemList[i].ReplacesItemId; Debug.WriteLine($"Writing {Items.ITEM_NAMES[itemId]} --> {Items.ITEM_NAMES[replacesItemId]}"); itemId = ItemUtils.SubtractItemOffset(itemId); replacesItemId = ItemUtils.SubtractItemOffset(replacesItemId); if (ItemUtils.IsBottleCatchContent(i)) { ItemSwapUtils.WriteNewBottle(replacesItemId, itemId); } else { ItemSwapUtils.WriteNewItem(replacesItemId, itemId, isRepeatable, isCycleRepeatable); } } if (_settings.AddShopItems) { ResourceUtils.ApplyHack(Values.ModsDirectory + "fix-shop-checks"); } }
public PSCharEnum(WorldSession session, List <character> characters) : base(WorldOpcodes.SMSG_CHAR_ENUM) { this.Session = session; this.Write((byte)characters.Count); foreach (character character in characters) { this.Write((ulong)character.guid); this.WriteCString(character.name); this.Write((byte)character.race); this.Write((byte)character.@class); this.Write((byte)character.gender); byte[] playerBytes = BitConverter.GetBytes(character.playerBytes); byte[] playerBytes2 = BitConverter.GetBytes(character.playerBytes2); this.Write((byte)playerBytes[0]); // Skin this.Write((byte)playerBytes[1]); // Face this.Write((byte)playerBytes[2]); // HairStyle this.Write((byte)playerBytes[3]); // HairColor this.Write((byte)playerBytes2[0]); // Accessory this.Write((byte)character.level); this.Write(0); // Zone ID Write((int)character.map); Write(character.position_x); Write(character.position_y); Write(character.position_z); this.Write(0); // Guild ID this.Write(0); // Character Flags this.Write((byte)0); // // Login Flags? this.Write(0); // Pet DisplayID this.Write(0); // Pet Level this.Write(0); // Pet FamilyID item_template[] equipment = ItemUtils.GenerateInventoryByIDs(Utils.CSVStringToIntArray(character.equipmentCache)); for (int itemSlot = 0; itemSlot < 19; itemSlot++) { if (equipment != null && equipment[itemSlot] != null) { Write(equipment[itemSlot].displayid); // Item DisplayID Write((byte)equipment[itemSlot].InventoryType); // Item Inventory Type } else { Write(0); Write((byte)0); } } this.Write(0); // first bag display id this.Write((byte)0); // first bag inventory type } }
public void SetCurrentPlayer(Player player) { currentPlayer = player; if (player == null) { transform.parent = ItemUtils.GetGame().transform; } }
public void UpdateChecks(string c) { updating = true; try { tStartingItemsString.Text = c; ItemListString = c; ItemList.Clear(); string[] v = c.Split('-'); int[] vi = new int[_itemGroupCount]; if (v.Length != vi.Length) { ExternalLabel = "Invalid custom starting item string"; return; } for (int i = 0; i < _itemGroupCount; i++) { if (v[_itemGroupCount - 1 - i] != "") { vi[i] = Convert.ToInt32(v[_itemGroupCount - 1 - i], 16); } } for (int i = 0; i < 32 * _itemGroupCount; i++) { int j = i / 32; int k = i % 32; if (((vi[j] >> k) & 1) > 0) { if (i >= ItemUtils.AllLocations().Count()) { throw new IndexOutOfRangeException(); } ItemList.Add(BaseItemList[i]); } } foreach (ListViewItem l in lStartingItems.Items) { if (ItemList.Contains((Item)l.Tag)) { l.Checked = true; } else { l.Checked = false; } } ExternalLabel = $"{ItemList.Count}/{BaseItemList.Count} items randomized"; } catch { ItemList.Clear(); ExternalLabel = "Invalid custom starting item string"; } finally { updating = false; } }
private void WriteItems() { if (Settings.LogicMode == LogicMode.Vanilla) { WriteFreeItem(Items.MaskDeku); if (Settings.ShortenCutscenes) { //giants cs were removed WriteFreeItem(Items.SongOath); } return; } //write free item int itemId = ItemList.FindIndex(u => u.ReplacesItemId == 0); WriteFreeItem(ItemList[itemId].ID); //write everything else ROMFuncs.ReplaceGetItemTable(ModsDirectory); ROMFuncs.InitItems(); for (int i = 0; i < ItemList.Count; i++) { itemId = ItemList[i].ID; // Unused item if (ItemList[i].ReplacesItemId == -1) { continue; } ; bool isRepeatable = Items.REPEATABLE.Contains(itemId); bool isCycleRepeatable = Items.CYCLE_REPEATABLE.Contains(itemId); int replacesItemId = ItemList[i].ReplacesItemId; itemId -= ItemUtils.GetItemOffset(itemId); replacesItemId -= ItemUtils.GetItemOffset(replacesItemId); if (ItemUtils.IsBottleCatchContent(i)) { ROMFuncs.WriteNewBottle(replacesItemId, itemId); } else { ROMFuncs.WriteNewItem(replacesItemId, itemId, isRepeatable, isCycleRepeatable); } } if (Settings.AddShopItems) { ROMFuncs.ApplyHack(ModsDirectory + "fix-shop-checks"); } }
void AddItemToPosition(int position, EShoppingItemType itemType) { cartItemTypes[position] = itemType; cartGameObjects[position].ItemType = itemType; if (canReturnItemsToShelf || ItemUtils.IsFightingItem(itemType)) { cartGameObjects[position].SetCanClick(true); } }
public static Item Assemble(BLL.Interfaces.IItem item, string language) { return(new Item { Code = item.Code, Price = item.Price, Name = AssembleName(item.Names, language), MainImageName = ItemUtils.getMainImageName(item.Code) }); }
public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); // Ace of Spades if (modPlayer.AceOfSpades && crit) { damage = (int)(damage * 1.1f + 0.5f); for (int i = 0; i < 3; i++) { Dust.NewDust(target.position, target.width, target.height, ModContent.DustType <SpadeDust>(), 0, -0.8f); } } // Ace of Clubs if (modPlayer.AceOfClubs && crit && !target.friendly && target.lifeMax > 15 && !target.SpawnedFromStatue && target.type != NPCID.TargetDummy) { int money = (int)(300 * MathHelper.Clamp((float)damage / target.lifeMax, 1 / 295f, 1f)); for (int i = 0; i < 3; i++) { Dust.NewDust(target.position, target.width, target.height, ModContent.DustType <ClubDust>(), 0, -0.8f); } if (money / 1000000 > 0) { ItemUtils.NewItemWithSync(projectile.owner, (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.PlatinumCoin, money / 1000000); } money %= 1000000; if (money / 10000 > 0) { ItemUtils.NewItemWithSync(projectile.owner, (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.GoldCoin, money / 10000); } money %= 10000; if (money / 100 > 0) { ItemUtils.NewItemWithSync(projectile.owner, (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.SilverCoin, money / 100); } money %= 100; if (money > 0) { ItemUtils.NewItemWithSync(projectile.owner, (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.CopperCoin, money); } } // Briar Set Bonus if (modPlayer.reachSet && target.life <= target.life / 2 && projectile.thrown && crit) { damage = (int)(damage * 2.25f); } }
public List <Item> GetAllItems() { List <Item> list = ItemUtils.GetAllItemPrefabs().Values.Where(x => ItemUtils.IsValidGear(x) && isType(x)).ToList(); if (list.Count < 1) { UnityEngine.Debug.Log("There are 0 items of type: " + GetId() + ". This shouldn't be possible!!"); } return(list); }
public void ShouldInitializeItemUtils() { using (var db = SetupDb()) { var item = db.GetItem("/sitecore/Content/Content Item"); var utils = new ItemUtils(item); Assert.AreEqual(item, utils.Item); } }
private void UpdateCustomItemAmountLabel() { if (_settings.CustomItemList.Contains(-1)) { lCustomItemAmount.Text = "Invalid custom item string"; } else { lCustomItemAmount.Text = $"{_settings.CustomItemList.Count}/{ItemUtils.AllLocations().Count()} items randomized"; } }
public static FullItem AssembleFullItem(BLL.Interfaces.IItem item, string language) { return(new FullItem { Code = item.Code, Price = item.Price, Name = AssembleName(item.Names, language), MainImageName = ItemUtils.getMainImageName(item.Code), AdditionalImages = ItemUtils.GetItemAdditionalImageNames(item.Code) }); }
public static SafeGetResponse Call(ImmuService.ImmuServiceClient immuS, RootService rs, SafeGetOptions request) { var root = rs.GetRoot(); var index = new Immudb.Schema.Index { Index_ = root.Index }; var protoReq = new SafeGetOptions(request) { RootIndex = index }; var msg = immuS.SafeGet(protoReq); var verified = Proofs.Verify(msg.Proof, ItemUtils.GetHash(msg.Item), root); if (verified) { var toCache = new Root { Index = msg.Proof.At, Root_ = msg.Proof.Root }; try { rs.SetRoot(toCache); } catch (Exception e) { throw e; } } var i = msg.Item; var timestampBytes = i.Value.Take(8).ToArray(); if (BitConverter.IsLittleEndian) { Array.Reverse(timestampBytes); } return(new SafeGetResponse { Index = i.Index, Key = i.Key, Value = ByteString.CopyFrom(i.Value.Skip(8).ToArray()), Timestamp = BitConverter.ToInt64(timestampBytes), Verified = verified }); }
public override void OpenVanillaBag(string context, Player player, int arg) { if (context != "goodieBag") { return; } ItemUtils.DropCandy(player); if (Main.rand.Next(3) == 0) { string[] lootTable = { "MaskSchmo", "MaskGraydee", "MaskLordCake", "MaskVladimier", "MaskKachow", "MaskHulk", "MaskBlaze", "MaskSvante", "MaskIggy", "MaskYuyutsu", "MaskLeemyy", }; int loot = Main.rand.Next(lootTable.Length); player.QuickSpawnItem(mod.ItemType(lootTable[loot])); } }