//===================================================== void UnlockNPC(string NPCID) { int NumNPCs = NPCItemsManager.GetNumItems(); NPCItemData FoundNPCItem = null; for (int Idx = 0; Idx < NumNPCs; Idx++) { NPCItemData CurNPCItem = NPCItemsManager.GetNPCItem(Idx); if (CurNPCItem.CardId == NPCID) { // Card we just bought matches an NPC, unlock the NPC Debug.Log("Found NPC to unlock for this card: " + CurNPCItem.Id); eNPC FoundNPCId = eNPC.NULL; try { FoundNPCId = (eNPC)Enum.Parse(typeof(eNPC), CurNPCItem.Id); } catch { Debug.Log("Warning: FoundNPCId state not recognised!"); } GameDataManager.Instance.UnlockPlayerNPC(FoundNPCId, true); return; } } }
public static NPCData GetData(eNPC a_eNPC) { if (m_mapNPC.ContainsKey(a_eNPC) == false) { return(null); } return(m_mapNPC[a_eNPC]); }
public void Clear() { nX = 0; nY = 0; nRoomID = 0; eState = eRoomState.None; eExistNPC = eNPC.None; eOpenDir = eDir.None; bPortal = false; }
//================================================================== public static int GetNPCItemGemReward(eNPC itemId) { if (!_isItemListLoaded) { LoadItemsList(); } foreach (var item in _itemList) { if (itemId.ToString() == item.Id) { return(item.GemReward); } } return(-1); }
//================================================================== public static int GetNPCItemPopulationUnlock(eNPC itemId) { if (!_isItemListLoaded) { LoadItemsList(); } foreach (var item in _itemList) { if (itemId.ToString() == item.Id) { return(item.PopulationUnlock); } } return(-1); }
//================================================================== public static string GetNPCItemCardId(eNPC itemId) { if (!_isItemListLoaded) { LoadItemsList(); } foreach (var item in _itemList) { if (itemId.ToString() == item.Id) { return(item.CardId); } } return(string.Empty); }
//================================================================== public static NPCItemData GeNPCItem(eNPC itemId) { if (!_isItemListLoaded) { LoadItemsList(); } foreach (var item in _itemList) { if (itemId.ToString() == item.Id) { return(item); } } return(null); }
//================================================================== public static TradingCardSpreadsheetItem GetCard(eChestType type, eTradingCardClassification cardClassification, eTradingCardRarity cardRarity, eTradingCardCondition cardCondition) { TradingCardSpreadsheetItem card = new TradingCardSpreadsheetItem(); //if( _forceRareCardReward ) // type = eChestType.LARGE; if ((cardClassification != eTradingCardClassification.NULL) || (cardRarity != eTradingCardRarity.NULL)) { // Use a specific classification/type rather than a random one eNPC UnlockedNPC = eNPC.NULL; card = GetSpecificCardType(cardClassification, cardRarity, cardCondition, ref UnlockedNPC); return(card); } switch (type) { case eChestType.SMALL: // Return common card //card = TradingCardItemsManager.GetRandomCard( eTradingCardRarity.COMMON , 30.0f , eTradingCardRarity.VERYCOMMON , 70.0f ); card = GetRandomCard(eTradingCardRarity.COMMON, 30.0f, eTradingCardRarity.COMMON, 70.0f); break; case eChestType.MEDIUM: // Return common or uncommon card card = GetRandomCard(eTradingCardRarity.RARE, 100.0f, eTradingCardRarity.NULL, 0.0f); break; case eChestType.LARGE: // Return uncmmon or rare card //card = TradingCardItemsManager.GetRandomCard( eTradingCardRarity.VERYRARE , 80.0f , eTradingCardRarity.UNIQUE , 20.0f ); card = GetRandomCard(eTradingCardRarity.VERYRARE, 80.0f, eTradingCardRarity.VERYRARE, 20.0f); break; } return(card); }
//================================================================== // Use a specific classification/type rather than a random one public static TradingCardSpreadsheetItem GetSpecificCardType(eTradingCardClassification CardClassification, eTradingCardRarity CardRarity, eTradingCardCondition CardCondition, ref eNPC UnlockedNPC) { UnlockedNPC = eNPC.NULL; if (!isItemListLoaded) { LoadItemsList(); } if (CardRarity == eTradingCardRarity.TEACHER) { // If this is a 'teacher' card then unlock the next NPC in the list // If we can't unlock any switch it to a random 'rare' card instead // Get current population and find the first teacher above it // If teacher isn't owned then give the card int PlayerPopulation = GameDataManager.Instance.PlayerPopulation; int NumNPCs = NPCItemsManager.GetNumItems(); NPCItemData FoundNPCItem = null; bool bNPCFound = false; Debug.Log("Looking for TEACHER card - current population: " + PlayerPopulation); for (int Idx = 0; Idx < NumNPCs; Idx++) { NPCItemData CurNPCItem = NPCItemsManager.GetNPCItem(Idx); // Ignore CurNPCItem.PopulationUnlock of zero (default) if (CurNPCItem.PopulationUnlock == 0) { continue; } if (bNPCFound == false) { if (PlayerPopulation >= CurNPCItem.PopulationUnlock) { // Do we have this card already? int NumMint = 0; int NumScuffed = 0; TradingCardHeldItem CurHeldCard = GameDataManager.Instance.GetHeldTradingCard(CurNPCItem.CardId, ref NumMint, ref NumScuffed); if ((NumMint > 0) || (NumScuffed > 0)) { // Has card,keep searching } else { // Doesn't have card - add it bNPCFound = true; FoundNPCItem = CurNPCItem; Debug.Log("Found TEACHER card: " + FoundNPCItem.Id + " " + FoundNPCItem.CardId); } } } //Debug.Log( CurNPCItem.PopulationUnlock ); } // If no teacher card was given then use a random 'rare' card instead if (bNPCFound == false) { Debug.Log("No TEACHER card found - giving very rare card instead"); CardClassification = eTradingCardClassification.NULL; CardRarity = eTradingCardRarity.VERYRARE; } else { eNPC FoundNPCId = eNPC.NULL; try { FoundNPCId = (eNPC)Enum.Parse(typeof(eNPC), FoundNPCItem.Id); } catch { Debug.Log("Warning: FoundNPCId state not recognised!"); } UnlockedNPC = FoundNPCId; //GameDataManager.Instance.UnlockPlayerNPC( FoundNPCId ); return(GetTradingCardItem(FoundNPCItem.CardId)); } } if (CardClassification == eTradingCardClassification.NULL) { // Pick a random classification switch (UnityEngine.Random.Range(0, 3)) { case 0: CardClassification = eTradingCardClassification.WINX; break; case 1: CardClassification = eTradingCardClassification.WILD; break; case 2: CardClassification = eTradingCardClassification.STORY; break; } } if (CardRarity == eTradingCardRarity.NULL) { // Pick a random rarity (exclude teacher cards) CardRarity = (eTradingCardRarity)(UnityEngine.Random.Range((int)eTradingCardRarity.UNIQUE, (int)eTradingCardRarity.TEACHER)); } // Find all cards with this specification and pick a random one List <TradingCardSpreadsheetItem> CardList = new List <TradingCardSpreadsheetItem>(); foreach (TradingCardSpreadsheetItem Item in itemList) { if ((Item.classification == CardClassification) && (Item.rarity == CardRarity)) { CardList.Add(Item); } } // Pick from card list int CardIdx = UnityEngine.Random.Range(0, CardList.Count); if (CardList.Count == 0) { Debug.LogWarning("No cards to reward player!"); Debug.LogWarning("Classification: " + CardClassification + " Rarity: " + CardRarity + " Condition: " + CardCondition); return(itemList[0]); } else { return(CardList[CardIdx]); } }
// 테이블 public static NPCData GetData(this eNPC a_eNPC) { return(NPCTable.GetData(a_eNPC)); }