void ExpressSpawns() { Transform spawns = transform.Find("Spawns"); List <Transform> cspawns = new List <Transform> (); Transform tspawn = null; for (int i = 0; i < spawns.childCount; i++) { Transform child = spawns.GetChild(i); if (child.name.Contains("C")) { cspawns.Add(child); } else if (child.name.Contains("T")) { tspawn = child; } } // spawn crystals foreach (var spawn in cspawns) { Instantiate(crystalPrefab, spawn.position, spawn.rotation, transform); } // spawn treasure if (tspawn != null && !alreadyGotTreasure && allTreasures.Length - 1 >= TerrainManager.instance.curAstroidIndex) { TreasureData tData = allTreasures [TerrainManager.instance.curAstroidIndex]; Instantiate(tData.prefab, tspawn.position, tspawn.rotation, transform); } expressed = true; }
public void AddTreasureToInventory(TreasureData data) { m_inventory.Add(data); AddWeight(data.GetWeight()); NotifyInventoryChange(); }
public static ScenarioState CollectItem(this ScenarioState state, ItemData item, EntityData collector) { switch (item.itemCategory) { case ItemCategory.Treasure: if (collector != state.player) { break; } TreasureData treasure = item as TreasureData; state.inventory.gold += treasure.value; state.items.Remove(item); break; case ItemCategory.Trap: TrapData trap = item as TrapData; ApplyTrapToEntity(state, trap, collector); break; case ItemCategory.Artifact: if (collector != state.player) { break; } state.inventory.artifacts++; state.items.Remove(item); break; default: break; } return(state); }
public void SetItem(int index, TreasureData data) { m_itemIndex = index + 1; m_indexLabel.text = m_itemIndex.ToString(); m_itemImage.sprite = data.GetItemSprite(); m_targetKey = m_itemIndex.ToString(); }
// Start is called before the first frame update private IEnumerator Init() { JobData.Load(); SkillData.Load(); EnemyData.Load(); BattleTileData.Load(); BattlefieldData.Load(); BattleGroupData.Load(); BattleStatusData.Load(); ItemData.Load(); EquipData.Load(); ItemEffectData.Load(); LanguageData.Load(); DungeonData.Load(); RoomData.Load(); TreasureData.Load(); ConversationData.Load(); ShopData.Load(); DungeonGroupData.Load(); ExpData.Load(); NewCookData.Load(); yield return(new WaitForEndOfFrame()); InitManager(); MySceneManager.Instance.Load(); #if UNITY_EDITOR DebugCommand.Start(); #endif }
private void ReplaceTreasures(IEnumerable <Item> items) { var treasures = new TreasureData(rom); treasures.LoadTable(); var pool1 = GetLegendaryPool(); var pool2 = ItemLists.RareWeaponTier.Concat(ItemLists.RareArmorTier).Where(i => !pool1.Contains(i)).ToList(); var pool3 = ItemLists.CommonArmorTier.Concat(ItemLists.CommonWeaponTier).ToList(); var hqPool = new HashSet <Item>(pool1.Concat(pool2)); items = items.Where(i => hqPool.Contains(i)).ToArray(); foreach (var i in items) { var indices = treasures.Data.Select((item, idx) => (item, idx)).Where(e => e.item == i).ToList(); if (indices.Count > 0) { var idx = indices.PickRandom(rng).idx; treasures[idx] = ExtConsumables.ExtConsumableStartingEquipmentFix(pool3.PickRandom(rng), flags); } } treasures.StoreTable(); }
void PickTreasure(TreasureData treasure) { SoundController.Instance.PlayAudio(SoundController.AudioKey.PickObject); UIManager.Instance.HideInfoTooltip(); m_playerData.AddTreasureToInventory(treasure); treasure.gameObject.SetActive(false); }
public ExpChests(FF1Rom _rom, Flags _flags, MT19337 _rng) { rom = _rom; flags = _flags; rng = _rng; treasureData = new TreasureData(rom); itemPrices = new ItemPrices(rom); }
public void RemoveTreasureFromInventory(TreasureData data) { if (m_inventory.Contains(data)) { m_inventory.Remove(data); RemoveWeight(data.GetWeight()); NotifyInventoryChange(); } }
void ThrowTreasure(TreasureData treasure) { SoundController.Instance.PlayAudio(SoundController.AudioKey.ThrowObject); m_playerData.RemoveTreasureFromInventory(treasure); treasure.gameObject.SetActive(true); treasure.transform.position = m_transform.position + (transform.GetChild(0).forward * -1); treasure.transform.rotation = transform.GetChild(0).rotation; treasure.GetComponent <Rigidbody>().AddForce((transform.GetChild(0).forward * -1) * 150000, ForceMode.Impulse); treasure.tag = "TreasureMisplaced"; }
public void ShowInfoTooltip(TreasureData data, Vector3 position) { m_infoCard.SetItemData(data); var canvasSize = GetComponent <RectTransform>().sizeDelta; Vector2 screenPoint = RectTransformUtility.WorldToScreenPoint(Camera.main, position); m_infoCard.GetComponent <RectTransform>().anchoredPosition = screenPoint - canvasSize / 2.0f; m_infoCard.gameObject.SetActive(true); }
public override ItemData Copy() { TreasureData copy = ScriptableObject.CreateInstance(typeof(TreasureData)) as TreasureData; copy.value = value; copy.sprite = sprite; copy.ID = ID; copy.Duration = Duration; copy.Position = Position; return(copy); }
public override void OnNeighborBlockChanged(int x, int y, int z, int neighborX, int neighborY, int neighborZ) { int cellContents = base.SubsystemTerrain.Terrain.GetCellContents(neighborX, neighborY, neighborZ); if (cellContents != 0 && cellContents != 18) { return; } base.SubsystemTerrain.ChangeCell(x, y, z, Terrain.MakeBlockValue(0)); if (!m_random.Bool(0.25f)) { return; } int num = 0; int num2 = 0; float max = m_treasureData.Sum((TreasureData t) => t.Probability); float num3 = m_random.Float(0f, max); TreasureData[] treasureData = m_treasureData; for (int i = 0; i < treasureData.Length; i++) { TreasureData treasureData2 = treasureData[i]; num3 -= treasureData2.Probability; if (num3 <= 0f) { num = treasureData2.Value; num2 = m_random.Int(1, treasureData2.MaxCount); break; } } if (num != 0 && num2 > 0) { for (int j = 0; j < num2; j++) { m_subsystemPickables.AddPickable(num, 1, new Vector3(x, y, z) + m_random.Vector3(0.1f, 0.4f) + new Vector3(0.5f), Vector3.Zero, null); } int num4 = m_random.Int(3, 6); for (int k = 0; k < num4; k++) { m_subsystemPickables.AddPickable(248, 1, new Vector3(x, y, z) + m_random.Vector3(0.1f, 0.4f) + new Vector3(0.5f), Vector3.Zero, null); } } }
/// <summary> /// Only for use in scenario. /// </summary> public static void DealDamage(this EntityData entity, int amount, ScenarioState scenarioState) { int newHealth = entity.CurrentHealth - amount; entity.SetHealth(newHealth); if (entity.CheckThat(IsDead)) { scenarioState.enemies.RemoveAll(e => e == entity); TreasureData itemToSpawn = entity.dropItem as TreasureData; Vector2Int positionToSpawn = entity.Position; if (itemToSpawn != null && !scenarioState.DoesPositionContainItem(positionToSpawn)) { TreasureData itemInstance = UnityEngine.Object.Instantiate(itemToSpawn); itemInstance.Position = positionToSpawn; scenarioState.items.Add(itemInstance); } } }
private void SetLocalMapNightMode() { if (this.m_selectLocalMap != null) { this.SetLocalMapTitle(); this.UpdateTreasure(); for (int i = 0; i < 20; i++) { int num = this.m_selectLocalMap.MAP_INDEX[i]; if (num > 0) { MAP_INFO mapInfo = NrTSingleton <NrBaseTableManager> .Instance.GetMapInfo(num.ToString()); if (mapInfo != null) { bool flag; if (this.m_bNowNightMode) { flag = (mapInfo.MAP_NIGHTMODE == 1); } else { flag = (mapInfo.MAP_NIGHTMODE != 1); } TreasureData treasureCheck = this.GetTreasureCheck(num); if (NrTSingleton <ContentsLimitManager> .Instance.IsWarpMap(num)) { this.m_btLocalMap_AreaIcon[i].Visible = flag; this.m_lbLocalMap_AreaName[i].Visible = flag; if (treasureCheck != null) { treasureCheck.TreasureShow(flag); } } } } } } }
void OnMouseDown() { if (this.name.Equals("AddEvent")) { Dictionary <string, object> ev = new Dictionary <string, object> (); ev ["str"] = "strstr"; ev ["int"] = 12345; ev ["long"] = 12345678912345678; ev ["float"] = 12.345; ev ["double"] = 12.3459832987654; ev ["bool"] = true; td.AddEvent("unitytbl", ev, delegate() { print("AddEvent Success!!! : " + counter); }, delegate(string errorCode, string errorMsg) { print("AddEvent Error!!! : " + counter + ", errorCode=" + errorCode + ", errorMsg=" + errorMsg); } ); td.AddEvent("unitytbl", "another_event", "foobar"); counter++; } else if (this.name.Equals("UploadEvents")) { print("GetGlobalSessionId() before EndGlobalSession(): " + TreasureData.GetGlobalSessionId()); TreasureData.EndGlobalSession(); print("GetGlobalSessionId() after EndGlobalSession(): " + TreasureData.GetGlobalSessionId()); td.AddEvent("unitytbl", "event_type", "upload"); td.UploadEvents( delegate() { print("UploadEvents Success!!! : " + counter); }, delegate(string errorCode, string errorMsg) { print("UploadEvents Error!!! : " + counter + ", errorCode=" + errorCode + ", errorMsg=" + errorMsg); } ); counter++; } }
void showItemInfo(string id) { itemId = id; ItemSpec spec = SpecController.getItemById(id); curInfoSpec = spec; ItemInfo.transform.Find("ItemImage").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); ItemInfo.transform.Find("NameText").gameObject.GetComponent <Text> ().text = LanController.getString(spec.name).ToUpper(); ItemInfo.SetActive(true); GameObject buyBut = ItemInfo.transform.Find("BuyButton").gameObject; GameObject useBut = ItemInfo.transform.Find("UseButton").gameObject; useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("use").ToUpper(); GameObject treasurePartGrid = ItemInfo.transform.Find("TreasurePart").Find("Grid").gameObject; GameObject iconPart = ItemInfo.transform.Find("TreasurePart").Find("Icon").gameObject; iconPart.SetActive(false); ItemInfo.transform.Find("message").GetComponent <Text> ().text = spec.getMessage(); buyBut.SetActive(false); useBut.SetActive(false); int cost = 10000; if (spec.gem > 0) { cost = spec.gem; buyBut.transform.Find("Image").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/gemIcon"); } else { cost = spec.coin; buyBut.transform.Find("Image").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/CoinIcon"); } List <string[]> list = new List <string[]> (); if (spec.getItemType() == SpecController.TreasureType) { if (spec.gem > 0) { list.Add(new string[] { "gemIcon", "×" + cost }); } else { list.Add(new string[] { "CoinIcon", "×" + cost }); } useBut.SetActive(true); TreasureData treasure = GameController.GetInstance().treasureDatas [spec.item_id]; if (treasure == null || !GameController.GetInstance().IsPaymentInitialized()) { useBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("buy").ToUpper(); } else { useBut.transform.Find("Text").GetComponent <Text> ().text = treasure.priceString; } } else { bool owned = false; if (spec.getItemType() == SpecController.BulletType) { list.Add(new string[] { "AttackTipIcon", (spec as BulletItemSpec).attack.ToString() }); list.Add(new string[] { "frozen", (spec as BulletItemSpec).speed.ToString() }); List <string> bullets = PlayerData.getBullets(); if (bullets.Contains(spec.item_id)) { owned = true; if (PlayerData.getCurrentBullet() == spec.item_id) { useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("using").ToUpper(); } } } else if (spec.getItemType() == SpecController.CannonType) { list.Add(new string[] { "ExpIcon", (spec as CannonItemSpec).maxLevel.ToString() }); list.Add(new string[] { "AttackTipIcon", "+" + (spec as CannonItemSpec).attack.ToString() + "%" }); list.Add(new string[] { "frozen", "+" + (spec as CannonItemSpec).attackSpeed.ToString() + "%" }); List <string> cannons = PlayerData.getCannons(); if (cannons.Contains(spec.item_id)) { owned = true; if (PlayerData.getCurrentCannon() == spec.item_id) { useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("using").ToUpper(); } } } else if (spec.getItemType() == SpecController.BulletItemType) { list.Add(new string[] { "BulletShopIcon", "×" + spec.count.ToString() }); } if (owned) { useBut.SetActive(true); } else { buyBut.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); buyBut.SetActive(true); } } for (int i = 0; i < treasurePartGrid.transform.childCount; i++) { GameObject go = treasurePartGrid.transform.GetChild(i).gameObject; Destroy(go); } foreach (string[] l in list) { GameObject bt = (GameObject)Instantiate(iconPart, Vector3.zero, Quaternion.identity, treasurePartGrid.GetComponent <RectTransform>()); bt.transform.Find("Image").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + l[0]); bt.transform.Find("Text").GetComponent <Text>().text = l[1]; bt.SetActive(true); } }
// Use this for initialization void Start() { lock (_lock) { if (td == null) { /* Just for testing. Please ignore these API calls: start */ TreasureData.InitializeApiEndpoint("https://in.treasuredata.com"); TreasureData.DisableLogging(); /* Just for testing. Please ignore these API calls: end */ TreasureData.EnableLogging(); // TreasureData.InitializeApiEndpoint("https://anotherapiendpoint.treasuredata.com"); TreasureData.InitializeEncryptionKey("hello world"); TreasureData.InitializeDefaultDatabase("testdb"); td = new TreasureData("YOUR_WRITE_APIKEY"); /* For development mode to run application without real devices * See https://github.com/treasure-data/td-unity-sdk-package#development-mode-to-run-application-without-real-devices */ SimpleTDClient.SetDummyAppVersionNumber("77"); SimpleTDClient.SetDummyBoard("bravo"); SimpleTDClient.SetDummyBrand("htc_asia_wwe"); SimpleTDClient.SetDummyDevice("bravo"); SimpleTDClient.SetDummyDisplay("ERE27"); SimpleTDClient.SetDummyModel("HTC Desire"); SimpleTDClient.SetDummyOsVer("2.1"); SimpleTDClient.SetDummyOsType("android"); SimpleTDClient.SetDummyLocaleCountry("JP"); SimpleTDClient.SetDummyLocaleLang("ja"); td.SetSimpleTDClient(SimpleTDClient.Create()); /* Just for testing. Please ignore these API calls: start */ td.DisableAutoAppendUniqId(); td.DisableAutoAppendModelInformation(); td.DisableAutoAppendAppInformation(); td.DisableAutoAppendLocaleInformation(); td.DisableServerSideUploadTimestamp(); td.DisableAutoAppendRecordUUID(); td.DisableRetryUploading(); td.EnableRetryUploading(); td.EnableAutoAppendRecordUUID("test_random_uuid"); td.EnableServerSideUploadTimestamp(); td.StartSession("dummy_tbl"); td.EndSession("dummy_tbl"); /* Just for testing. Please ignore these API calls: end */ td.EnableAutoAppendUniqId(); td.EnableAutoAppendModelInformation(); td.EnableAutoAppendAppInformation(); td.EnableAutoAppendLocaleInformation(); td.EnableAutoAppendRecordUUID(); td.EnableServerSideUploadTimestamp("server_time"); print("GetGlobalSessionId() before StartGlobalSession(): " + TreasureData.GetGlobalSessionId()); TreasureData.StartGlobalSession(); print("GetGlobalSessionId() after StartGlobalSession(): " + TreasureData.GetGlobalSessionId()); if (td.IsFirstRun()) { td.AddEvent("unitytbl", "installed", true, delegate() { td.ClearFirstRun(); }, delegate(string errorCode, string errorMsg) { print("AddEvent Error!!! : errorCode=" + errorCode + ", errorMsg=" + errorMsg); } ); td.UploadEvents(); } } } }
public static void OpenTreasureMenuEndFunction(FishingRod rod, int extra) { ModFishing.INSTANCE.Monitor.Log("Successfully replaced treasure", LogLevel.Trace); ConfigMain config = ModFishing.INSTANCE.Config; SFarmer lastUser = ModFishing.INSTANCE.Helper.Reflection.GetPrivateValue <SFarmer>(rod, "lastUser"); int clearWaterDistance = 5; if (config.OverrideFishing) { if (FishingRodOverrides.ClearWaterDistances.ContainsKey(lastUser)) { clearWaterDistance = FishingRodOverrides.ClearWaterDistances[lastUser]; } else { ModFishing.INSTANCE.Monitor.Log("The bobber bar was not replaced. Fishing might not be overridden by this mod", LogLevel.Warn); } } int whichFish = ModFishing.INSTANCE.Helper.Reflection.GetPrivateValue <int>(rod, "whichFish"); int fishQuality = ModFishing.INSTANCE.Helper.Reflection.GetPrivateValue <int>(rod, "fishQuality"); lastUser.gainExperience(5, 10 * (clearWaterDistance + 1)); rod.doneFishing(lastUser, true); lastUser.completelyStopAnimatingOrDoingAction(); // REWARDS List <Item> rewards = new List <Item>(); if (extra == 1) { rewards.Add(new StardewValley.Object(whichFish, 1, false, -1, fishQuality)); } List <TreasureData> possibleLoot = new List <TreasureData>(config.PossibleLoot) .Where(treasure => treasure.IsValid(lastUser.FishingLevel, clearWaterDistance)).ToList(); // Select rewards float chance = 1f; int streak = FishHelper.GetStreak(lastUser); while (possibleLoot.Count > 0 && rewards.Count < config.MaxTreasureQuantity && Game1.random.NextDouble() <= chance) { TreasureData treasure = possibleLoot.Choose(Game1.random); int id = treasure.id + Game1.random.Next(treasure.idRange - 1); if (id == Objects.LOST_BOOK) { if (lastUser.archaeologyFound == null || !lastUser.archaeologyFound.ContainsKey(102) || lastUser.archaeologyFound[102][0] >= 21) { continue; } Game1.showGlobalMessage("You found a lost book. The library has been expanded."); } int count = Game1.random.Next(treasure.minAmount, treasure.maxAmount); Item reward; if (treasure.meleeWeapon) { reward = new MeleeWeapon(id); } else if (id >= Ring.ringLowerIndexRange && id <= Ring.ringUpperIndexRange) { reward = new Ring(id); } else if (id >= 504 && id <= 513) { reward = new Boots(id); } else { reward = new StardewValley.Object(Vector2.Zero, id, count); } rewards.Add(reward); if (!config.AllowDuplicateLoot || !treasure.allowDuplicates) { possibleLoot.Remove(treasure); } //rewards.Add(new StardewValley.Object(Vector2.Zero, Objects.BAIT, Game1.random.Next(10, 25))); } // Add bait if no rewards were selected. NOTE: This should never happen if (rewards.Count == 0) { ModFishing.INSTANCE.Monitor.Log("Could not find any valid loot for the treasure chest. Check your treasure.json?", LogLevel.Warn); rewards.Add(new StardewValley.Object(685, Game1.random.Next(2, 5) * 5, false, -1, 0)); } // Show rewards GUI Game1.activeClickableMenu = new ItemGrabMenu(rewards); (Game1.activeClickableMenu as ItemGrabMenu).source = 3; lastUser.completelyStopAnimatingOrDoingAction(); }
static SubsystemTreasureGeneratorBlockBehavior() { TreasureData[] array = new TreasureData[61]; TreasureData treasureData = new TreasureData { Value = 79, Probability = 4f, MaxCount = 4 }; array[0] = treasureData; treasureData = new TreasureData { Value = 111, Probability = 1f, MaxCount = 1 }; array[1] = treasureData; treasureData = new TreasureData { Value = 43, Probability = 4f, MaxCount = 4 }; array[2] = treasureData; treasureData = new TreasureData { Value = 40, Probability = 2f, MaxCount = 3 }; array[3] = treasureData; treasureData = new TreasureData { Value = 42, Probability = 4f, MaxCount = 3 }; array[4] = treasureData; treasureData = new TreasureData { Value = 22, Probability = 4f, MaxCount = 4 }; array[5] = treasureData; treasureData = new TreasureData { Value = 103, Probability = 2f, MaxCount = 4 }; array[6] = treasureData; treasureData = new TreasureData { Value = 150, Probability = 1f, MaxCount = 1 }; array[7] = treasureData; treasureData = new TreasureData { Value = 21, Probability = 2f, MaxCount = 16 }; array[8] = treasureData; treasureData = new TreasureData { Value = 159, Probability = 2f, MaxCount = 4 }; array[9] = treasureData; treasureData = new TreasureData { Value = 207, Probability = 2f, MaxCount = 4 }; array[10] = treasureData; treasureData = new TreasureData { Value = 17, Probability = 2f, MaxCount = 2 }; array[11] = treasureData; treasureData = new TreasureData { Value = 31, Probability = 4f, MaxCount = 4 }; array[12] = treasureData; treasureData = new TreasureData { Value = 108, Probability = 4f, MaxCount = 8 }; array[13] = treasureData; treasureData = new TreasureData { Value = 109, Probability = 2f, MaxCount = 4 }; array[14] = treasureData; treasureData = new TreasureData { Value = 105, Probability = 1f, MaxCount = 4 }; array[15] = treasureData; treasureData = new TreasureData { Value = 106, Probability = 1f, MaxCount = 2 }; array[16] = treasureData; treasureData = new TreasureData { Value = 107, Probability = 1f, MaxCount = 1 }; array[17] = treasureData; treasureData = new TreasureData { Value = 234, Probability = 1f, MaxCount = 4 }; array[18] = treasureData; treasureData = new TreasureData { Value = 235, Probability = 1f, MaxCount = 2 }; array[19] = treasureData; treasureData = new TreasureData { Value = 236, Probability = 1f, MaxCount = 1 }; array[20] = treasureData; treasureData = new TreasureData { Value = 132, Probability = 2f, MaxCount = 2 }; array[21] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(173, 0, 6), Probability = 2f, MaxCount = 8 }; array[22] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(173, 0, 7), Probability = 8f, MaxCount = 8 }; array[23] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(173, 0, 5), Probability = 8f, MaxCount = 8 }; array[24] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(173, 0, 6), Probability = 2f, MaxCount = 8 }; array[25] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(119, 0, 0), Probability = 2f, MaxCount = 8 }; array[26] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(119, 0, 1), Probability = 2f, MaxCount = 8 }; array[27] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(119, 0, 2), Probability = 2f, MaxCount = 8 }; array[28] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(119, 0, 3), Probability = 2f, MaxCount = 8 }; array[29] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(119, 0, 4), Probability = 2f, MaxCount = 8 }; array[30] = treasureData; treasureData = new TreasureData { Value = 191, Probability = 4f, MaxCount = 1 }; array[31] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, ArrowBlock.ArrowType.CopperArrow)), Probability = 2f, MaxCount = 2 }; array[32] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, ArrowBlock.ArrowType.IronArrow)), Probability = 2f, MaxCount = 2 }; array[33] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, ArrowBlock.ArrowType.DiamondArrow)), Probability = 1f, MaxCount = 2 }; array[34] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, ArrowBlock.ArrowType.FireArrow)), Probability = 2f, MaxCount = 2 }; array[35] = treasureData; treasureData = new TreasureData { Value = 200, Probability = 1f, MaxCount = 1 }; array[36] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, ArrowBlock.ArrowType.IronBolt)), Probability = 2f, MaxCount = 2 }; array[37] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, ArrowBlock.ArrowType.DiamondBolt)), Probability = 1f, MaxCount = 2 }; array[38] = treasureData; treasureData = new TreasureData { Value = Terrain.MakeBlockValue(192, 0, ArrowBlock.SetArrowType(0, ArrowBlock.ArrowType.ExplosiveBolt)), Probability = 1f, MaxCount = 2 }; array[39] = treasureData; treasureData = new TreasureData { Value = 212, Probability = 1f, MaxCount = 1 }; array[40] = treasureData; treasureData = new TreasureData { Value = 124, Probability = 1f, MaxCount = 1 }; array[41] = treasureData; treasureData = new TreasureData { Value = 125, Probability = 1f, MaxCount = 1 }; array[42] = treasureData; treasureData = new TreasureData { Value = 82, Probability = 1f, MaxCount = 1 }; array[43] = treasureData; treasureData = new TreasureData { Value = 116, Probability = 1f, MaxCount = 1 }; array[44] = treasureData; treasureData = new TreasureData { Value = 36, Probability = 1f, MaxCount = 1 }; array[45] = treasureData; treasureData = new TreasureData { Value = 113, Probability = 1f, MaxCount = 1 }; array[46] = treasureData; treasureData = new TreasureData { Value = 38, Probability = 1f, MaxCount = 1 }; array[47] = treasureData; treasureData = new TreasureData { Value = 115, Probability = 1f, MaxCount = 1 }; array[48] = treasureData; treasureData = new TreasureData { Value = 37, Probability = 1f, MaxCount = 1 }; array[49] = treasureData; treasureData = new TreasureData { Value = 114, Probability = 1f, MaxCount = 1 }; array[50] = treasureData; treasureData = new TreasureData { Value = 171, Probability = 1f, MaxCount = 1 }; array[51] = treasureData; treasureData = new TreasureData { Value = 172, Probability = 1f, MaxCount = 1 }; array[52] = treasureData; treasureData = new TreasureData { Value = 90, Probability = 1f, MaxCount = 1 }; array[53] = treasureData; treasureData = new TreasureData { Value = 160, Probability = 1f, MaxCount = 1 }; array[54] = treasureData; treasureData = new TreasureData { Value = 158, Probability = 2f, MaxCount = 1 }; array[55] = treasureData; treasureData = new TreasureData { Value = 133, Probability = 1f, MaxCount = 10 }; array[56] = treasureData; treasureData = new TreasureData { Value = 179, Probability = 1f, MaxCount = 2 }; array[57] = treasureData; treasureData = new TreasureData { Value = 142, Probability = 1f, MaxCount = 2 }; array[58] = treasureData; treasureData = new TreasureData { Value = 141, Probability = 1f, MaxCount = 2 }; array[59] = treasureData; treasureData = new TreasureData { Value = 237, Probability = 1f, MaxCount = 2 }; array[60] = treasureData; m_treasureData = array; }
public void init(ItemSpec _spec) { spec = _spec; transform.Find("Text").GetComponent <Text> ().text = LanController.getString(spec.name).ToUpper(); transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); GameObject buyBut = transform.Find("BuyButton").gameObject; GameObject useBut = transform.Find("UseButton").gameObject; useBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("Use").ToUpper(); int cost = 10000; if (spec.gem > 0) { cost = spec.gem; transform.Find("BuyButton").Find("Image").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/gemIcon"); } else { cost = spec.coin; } useBut.SetActive(false); switch (spec.getItemType()) { case SpecController.TreasureType: transform.Find("StarImage").gameObject.SetActive(true); useBut.SetActive(true); buyBut.SetActive(false); TreasureData treasure = GameController.GetInstance().treasureDatas [spec.item_id]; if (treasure == null || !GameController.GetInstance().IsPaymentInitialized()) { useBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("buy").ToUpper(); } else { useBut.transform.Find("Text").GetComponent <Text> ().text = treasure.priceString; } break; case SpecController.BulletType: List <string> bullets = PlayerData.getBullets(); if (bullets.Contains(spec.item_id)) { buyBut.SetActive(false); useBut.SetActive(true); if (PlayerData.getCurrentBullet() == spec.item_id) { useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("using").ToUpper(); } } else { buyBut.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); } break; case SpecController.CannonType: List <string> cannons = PlayerData.getCannons(); if (cannons.Contains(spec.item_id)) { buyBut.SetActive(false); useBut.SetActive(true); if (PlayerData.getCurrentCannon() == spec.item_id) { useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("using").ToUpper(); } } else { buyBut.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); } break; default: buyBut.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); buyBut.SetActive(true); break; } }
internal static List <Item> GetTreasure(List <Item> gameLoot) { List <Item> rewards = new List <Item>(); var location = Game1.player.currentLocation; if (location is IslandLocation) { return(gameLoot); } //Treasure Groups List <TreasureGroup> possibleGroups; if (PanningMod.Instance.areaTreasureGroups.ContainsKey(location.Name)) { possibleGroups = PanningMod.Instance.areaTreasureGroups[location.Name].Values .Where(group => group.Enabled == true) .OrderBy(group => group.GroupChance) .ToList(); } else { possibleGroups = PanningMod.Instance.defaultTresureGroups.Values .Where(group => group.Enabled == true) .OrderBy(group => group.GroupChance) .ToList(); } // Select rewards double chance = 1f; int lootCount = 0; while (possibleGroups.Count > 0 && Game1.random.NextDouble() <= chance) { TreasureGroup group = possibleGroups.ChooseItem(Game1.random); // Possible treasure based on selected treasure group selected above. List <TreasureData> possibleLoot = new List <TreasureData>(group.treasureList) .Where(loot => loot.Enabled) .OrderBy(loot => loot.Chance) .ThenBy(loot => loot.Id) .ToList(); if (possibleLoot.Count == 0) { PanningMod.Instance.Monitor.Log($" Group: {group.GroupID}, No Possible Loot Found... check the logic"); break; } TreasureData treasure = possibleLoot.ChooseItem(Game1.random); int id = treasure.Id; // Lost books have custom handling if (id == 102) // LostBook Item ID { if (Game1.player.archaeologyFound == null || !Game1.player.archaeologyFound.ContainsKey(102) || Game1.player.archaeologyFound[102][0] >= 21) { possibleLoot.Remove(treasure); continue; } Game1.showGlobalMessage("You found a lost book. The library has been expanded."); } // Create reward item Item reward; if (group.GroupID == TREASURE_GROUP.Rings) { reward = new Ring(id); } else if (group.GroupID == TREASURE_GROUP.Boots) { reward = new Boots(id); } else { // Random quantity int count = Game1.random.Next(treasure.MinAmount, treasure.MaxAmount); reward = new StardewValley.Object(id, count); } // Add the reward rewards.Add(reward); // Check if this reward shouldn't be duplicated if (!treasure.AllowDuplicates) { possibleLoot.Remove(treasure); } // Update chance chance *= PanningMod.Instance.config.additionalLootChance + Game1.player.DailyLuck; if (lootCount > 2 && chance >= 1.0) { break; } lootCount++; } return(rewards); }
public ScoreData(TreasureData treasureData, GameObject obj) { this.m_treasureData = treasureData; this.m_obj = obj; }
private void SetLocalMapMapIcon() { this.UpdateTreasure(); MAP_INFO mapInfo = NrTSingleton <NrBaseTableManager> .Instance.GetMapInfo(this.m_pkCharMapInfo.m_nMapIndex.ToString()); int num = 0; if (mapInfo != null) { num = mapInfo.MAP_INDEX; } for (int i = 0; i < 20; i++) { int num2 = this.m_selectLocalMap.MAP_INDEX[i]; MAP_INFO mapInfo2 = NrTSingleton <NrBaseTableManager> .Instance.GetMapInfo(num2.ToString()); bool flag = true; if (num2 <= 0 || mapInfo2 == null) { flag = false; } if (!NrTSingleton <ContentsLimitManager> .Instance.IsWarpMap(num2)) { flag = false; } TreasureData treasureCheck = this.GetTreasureCheck(num2); if (!flag) { this.m_btLocalMap_AreaIcon[i].Hide(true); this.m_lbLocalMap_AreaName[i].Hide(true); if (treasureCheck != null) { treasureCheck.TreasureShow(false); } } else { this.m_btLocalMap_AreaIcon[i].Hide(false); this.m_lbLocalMap_AreaName[i].Hide(false); this.m_btLocalMap_AreaIcon[i].SetLocation(mapInfo2.MAP_X + 20f, mapInfo2.MAP_Y + 64f, -0.1f); string textFromMap = NrTSingleton <NrTextMgr> .Instance.GetTextFromMap(mapInfo2.TEXTKEY); if (textFromMap != string.Empty) { this.m_lbLocalMap_AreaName[i].SetText(textFromMap); this.m_lbLocalMap_AreaName[i].SetLocation(mapInfo2.MAP_X + 20f + -107f, mapInfo2.MAP_Y + 64f + 84f, -0.1f); } if (mapInfo2.MAP_ICON != string.Empty) { this.m_btLocalMap_AreaIcon[i].SetButtonTextureKey(mapInfo2.MAP_ICON); } this.m_btLocalMap_AreaIcon[i].AddValueChangedDelegate(new EZValueChangedDelegate(this.OnClickLocaldMapToMapIcon)); this.m_btLocalMap_AreaIcon[i].Data = num2; this.m_btLocalMap_AreaIcon[i].Visible = true; if (treasureCheck != null) { if (num != 0 && treasureCheck.GetMapIndex() == num) { treasureCheck.TreasureShow(true); treasureCheck.SetPostion(mapInfo2.MAP_X + 40f, mapInfo2.MAP_Y - 16f); } else { treasureCheck.TreasureShow(true); treasureCheck.SetPostion(mapInfo2.MAP_X + 10f, mapInfo2.MAP_Y - 16f); } } } } }
public Treasure(int id) { TreasureData.RootObject data = TreasureData.GetData(id); TileName = data.Image; ItemList = data.GetItemList(); }
public void SetItemData(TreasureData data) { m_itemValue.text = data.GetValue().ToString(); m_itemWeight.text = data.GetWeight().ToString(); }
/// <summary> /// お宝を落とした時の処理 /// </summary> public void TropTresure(TreasureData treasureData) { m_stockTreasures.Add(treasureData); CreateTresure(); }