public static bool ReLoad() { try { CardGrooveUpdateInfo[] array = CardMgr.LoadGrooveUpdateDb(); Dictionary <int, List <CardGrooveUpdateInfo> > value = CardMgr.LoadGrooveUpdates(array); if (array != null) { Interlocked.Exchange <CardGrooveUpdateInfo[]>(ref CardMgr.m_grooveUpdate, array); Interlocked.Exchange <Dictionary <int, List <CardGrooveUpdateInfo> > >(ref CardMgr.m_grooveUpdates, value); } CardTemplateInfo[] array2 = CardMgr.LoadCardBoxDb(); Dictionary <int, List <CardTemplateInfo> > value2 = CardMgr.LoadCardBoxs(array2); if (array2 != null) { Interlocked.Exchange <CardTemplateInfo[]>(ref CardMgr.m_cardBox, array2); Interlocked.Exchange <Dictionary <int, List <CardTemplateInfo> > >(ref CardMgr.m_cardBoxs, value2); } } catch (Exception exception) { if (CardMgr.log.IsErrorEnabled) { CardMgr.log.Error("ReLoad", exception); } return(false); } return(true); }
public static int GetGP(int level, int type) { for (int i = 1; i <= CardMgr.MaxLv(type); i++) { if (level == CardMgr.FindCardGrooveUpdate(type)[i].Level) { return(CardMgr.FindCardGrooveUpdate(type)[i].Exp); } } return(0); }
public static List <CardGrooveUpdateInfo> FindCardGrooveUpdate(int type) { if (CardMgr.m_grooveUpdates == null) { CardMgr.Init(); } if (CardMgr.m_grooveUpdates.ContainsKey(type)) { return(CardMgr.m_grooveUpdates[type]); } return(null); }
public static List <CardTemplateInfo> FindCardBox(int cardId) { if (CardMgr.m_cardBoxs == null) { CardMgr.Init(); } if (CardMgr.m_cardBoxs.ContainsKey(cardId)) { return(CardMgr.m_cardBoxs[cardId]); } return(null); }
public static CardTemplateInfo GetSingleCard(int id) { List <CardTemplateInfo> allCard = CardMgr.GetAllCard(); foreach (CardTemplateInfo current in allCard) { if (current.ID == id) { return(current); } } return(null); }
public static int GetProp(UsersCardInfo slot, int type) { int num = 0; for (int i = 0; i < slot.Level; i++) { num += CardMgr.GetGrooveSlot(slot.Type, i, type); } if (slot.CardID != 0) { num += CardMgr.GetPropCard(slot.CardType, slot.CardID, type); } return(num); }
public static int GetLevel(int GP, int type) { if (GP >= CardMgr.FindCardGrooveUpdate(type)[CardMgr.MaxLv(type)].Exp) { return(CardMgr.FindCardGrooveUpdate(type)[CardMgr.MaxLv(type)].Level); } for (int i = 1; i <= CardMgr.MaxLv(type); i++) { if (GP < CardMgr.FindCardGrooveUpdate(type)[i].Exp) { int index = (i - 1 == -1) ? 0 : (i - 1); return(CardMgr.FindCardGrooveUpdate(type)[index].Level); } } return(0); }
public static CardTemplateInfo GetCard(int cardId) { CardTemplateInfo cardTemplateInfo = new CardTemplateInfo(); List <CardTemplateInfo> list = CardMgr.FindCardBox(cardId); int num = 1; int maxRound = 0; foreach (CardTemplateInfo current in list) { if (maxRound >= current.probability) { maxRound = current.probability; } } maxRound = CardMgr.random.Next(maxRound); List <CardTemplateInfo> list2 = ( from s in list where s.probability >= maxRound select s).ToList <CardTemplateInfo>(); int num2 = list2.Count <CardTemplateInfo>(); if (num2 > 0) { num = ((num > num2) ? num2 : num); int[] randomUnrepeatArray = CardMgr.GetRandomUnrepeatArray(0, num2 - 1, num); int[] array = randomUnrepeatArray; for (int i = 0; i < array.Length; i++) { int index = array[i]; cardTemplateInfo = list2[index]; } } if (cardTemplateInfo.CardType == 0) { return(null); } return(cardTemplateInfo); }
public static List <CardTemplateInfo> GetAllCard() { if (CardMgr.m_cardBox == null) { CardMgr.Init(); } List <CardTemplateInfo> list = new List <CardTemplateInfo>(); Dictionary <int, CardTemplateInfo> dictionary = new Dictionary <int, CardTemplateInfo>(); CardTemplateInfo[] cardBox = CardMgr.m_cardBox; for (int i = 0; i < cardBox.Length; i++) { CardTemplateInfo cardTemplateInfo = cardBox[i]; if (!dictionary.Keys.Contains(cardTemplateInfo.CardID)) { if (cardTemplateInfo.CardID != 314150) { list.Add(cardTemplateInfo); } dictionary.Add(cardTemplateInfo.CardID, cardTemplateInfo); } } return(list); }
public static bool Init() { return(CardMgr.ReLoad()); }
public static int MaxLv(int type) { return(CardMgr.FindCardGrooveUpdate(type).Count - 1); }