public int GetExpByXGem(XGem gem) { DGem gemDB = ReadCfgGem.GetDataById(gem.Id); int exp = gem.StrengthenExp + gemDB.Exp; int lv = gem.StrengthenLevel; for (int i = 0; i < lv; i++) { DGemLevel db = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + gem.StrengthenLevel); exp += db.RequireExp; } return(exp); }
private void ShowView() { labMoneyNum1.text = GTDataManager.Instance.GetItemCountById(1).ToString(); labMoneyNum2.text = GTDataManager.Instance.GetItemCountById(2).ToString(); GTItemHelper.ShowItemTexture(moneyTexture1, 1); GTItemHelper.ShowItemTexture(moneyTexture2, 2); XGem gem = GTDataManager.Instance.GetGemDataByPos(mPosType, mPos); int itemID = gem.Id; GTItemHelper.ShowItemTexture(gemTexture, itemID); GTItemHelper.ShowItemQuality(gemQuality, itemID); GTItemHelper.ShowItemName(gemName, itemID); int costgemNum = mStrengthenMats.Count; for (int i = 0; i < mStrengthenItems.Count; i++) { ItemStrengthen cell = mStrengthenItems[i]; if (i < costgemNum) { XItem mat = mStrengthenMats[i]; cell.Show(true); int id = mStrengthenMats[i].Id; GTItemHelper.ShowItemTexture(cell.itemTexture, id); GTItemHelper.ShowItemQuality(cell.itemQuality, id); GTItemHelper.ShowItemNum(cell.itemNum, mat.Num); } else { cell.Show(false); } } if (GemModule.Instance.IsFullStrengthenLevel(gem) == true) { return; } DGem gemDB = ReadCfgGem.GetDataById(itemID); DGemLevel levelDB = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + gem.StrengthenLevel + 1); int addExpNum = GemModule.Instance.GetExpByStrengthMatList(mStrengthenMats); GTItemHelper.ShowItemTexture(costMoneyTexture, levelDB.CostMoneyId); costMoneyNum.text = addExpNum.ToString(); gemLevel.text = GTTools.Format("强化等级 {0}", gem.StrengthenLevel); GTItemHelper.ShowProgressText(gemExpNum, gem.StrengthenExp, levelDB.RequireExp); GTItemHelper.ShowProgressSlider(gemExpBar, gem.StrengthenExp, levelDB.RequireExp); GTItemHelper.ShowGemPropertyText(gemProperty, itemID, gem.StrengthenLevel, true); gemSuit.text = GemModule.Instance.GetGemSuitName(itemID); gemType.text = GemModule.Instance.GetGemTypeName(itemID); }
private void OnAck_StrengthGem(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); AckStrengthGem ack = Serializer.Deserialize <AckStrengthGem>(ms); XGem gem = ack.TarGem; List <XItem> list = ack.UseItems; DGem gemDB = ReadCfgGem.GetDataById(gem.Id); int addExpNum = MLGem.Instance.GetExpByStrengthMatList(list); int strengthenLevel = gem.StrengthenLevel; int levelID = gemDB.Quality * 1000 + strengthenLevel + 1; DGemLevel db = ReadCfgGemLevel.GetDataById(levelID); int expNum = db.RequireExp - gem.StrengthenExp; while (addExpNum >= expNum) { strengthenLevel++; levelID = gemDB.Quality * 1000 + strengthenLevel + 1; db = ReadCfgGemLevel.GetDataById(levelID); expNum += db.RequireExp; } gem.StrengthenLevel = strengthenLevel; gem.StrengthenExp = addExpNum + db.RequireExp - expNum; DataDBSGem.Update(gem.Instance, gem); GTDataManager.Instance.UseMoney(db.CostMoneyId, expNum); for (int i = 0; i < list.Count; i++) { XItem item = list[i]; EPosType posType = (EPosType)item.PosType; switch (posType) { case EPosType.BagItem: GTDataManager.Instance.UseItemById(item.Id, item.Num); break; case EPosType.BagGem: GTDataManager.Instance.DelBagGem(item.Pos); break; } } GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR); GTEventCenter.FireEvent(GTEventID.TYPE_BAG_STRENGTHEN_GEM); GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE); }
public static void ShowGemPropertyText(UILabel label, int gemID, int level, bool showNext = false) { if (label.text == null) { return; } label.text = string.Empty; DGem gemDB = ReadCfgGem.GetDataById(gemID); DGemLevel db1 = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + level); DGemLevel db2 = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + level + 1); for (int i = 0; i < gemDB.Propertys.Count; i++) { DStrengthValue gp = gemDB.Propertys[i]; if (!ReadCfgProperty.ContainsKey(gp.Property)) { continue; } DProperty propertyDB = ReadCfgProperty.GetDataById(gp.Property); int ratio = level > 0 ? db1.PropertyRatio : 100; string s = GTTools.Format(propertyDB.Desc, (int)(gp.Value * ratio / 100f)); int add = (int)(gp.Value * (db2.PropertyRatio - ratio) / 100f); string str = string.Empty; if (level >= gp.UnlockLevel) { if (showNext) { str = GTTools.Format("[00ff00]{0}(+{1})[-]", s, add); } else { str = GTTools.Format("[00ff00]{0}[-]", s); } } else { str = GTTools.Format("[777777]{0} (宝石强化至{1}级生效)[-]", s, gp.UnlockLevel); } label.Append(str); } label.text = label.text.TrimEnd('\n'); }
static void CalcGemStrenthLevel(Dictionary <EAttr, int> dict, XGem gem) { DGem gemDB = ReadCfgGem.GetDataById(gem.Id); DGemLevel db = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + gem.StrengthenLevel); for (int i = 0; i < gemDB.Propertys.Count; i++) { DStrengthValue gp = gemDB.Propertys[i]; if (gem.StrengthenLevel >= gp.UnlockLevel) { dict[gp.Property] += gp.Value; int ratio = gem.StrengthenLevel > 0 ? db.PropertyRatio : 100; dict[gp.Property] = (int)(dict[gp.Property] * ratio / 100f); } else { break; } } }
public override void Init() { ReadCfgLocalString.Read("Text/Local/Data_LocalString"); ReadCfgCurve.Read("Text/Local/Data_Curve"); ReadCfgStageMount.Read("Text/Local/Data_StageMount"); ReadCfgStagePartner.Read("Text/Local/Data_StagePartner"); ReadCfgStagePet.Read("Text/Local/Data_StagePet"); ReadCfgStageRelics.Read("Text/Local/Data_StageRelics"); ReadCfgStageRole.Read("Text/Local/Data_StageRole"); ReadCfgSearch.Read("Text/Local/Data_Search"); ReadCfgRandomName.Read("Text/Local/Data_RandomNames"); ReadCfgProperty.Read("Text/Data/Data_Property"); ReadCfgQuality.Read("Text/Data/Data_Quality"); ReadCfgItem.Read("Text/Data/Data_Item"); ReadCfgEquip.Read("Text/Data/Data_Equip"); ReadCfgAction.Read("Text/Data/Data_Action"); ReadCfgRole.Read("Text/Data/Data_Role"); ReadCfgRoleLevel.Read("Text/Data/Data_RoleLevel"); ReadCfgEquip.Read("Text/Data/Data_Equip"); ReadCfgEquipAdvance.Read("Text/Data/Data_EquipAdvance"); ReadCfgEquipAdvanceCost.Read("Text/Data/Data_EquipAdvanceCost"); ReadCfgEquipStreng.Read("Text/Data/Data_EquipStrengthen"); ReadCfgEquipStrengLevel.Read("Text/Data/Data_EquipStrengthenLevel"); ReadCfgEquipStar.Read("Text/Data/Data_EquipStar"); ReadCfgEquipSuit.Read("Text/Data/Data_EquipSuit"); ReadCfgGem.Read("Text/Data/Data_Gem"); ReadCfgGemLevel.Read("Text/Data/Data_GemLevel"); ReadCfgGemSuit.Read("Text/Data/Data_GemSuit"); ReadCfgAward.Read("Text/Data/Data_Award"); ReadCfgCopyMainChapter.Read("Text/Data/Data_CopyMainChapter"); ReadCfgCopy.Read("Text/Data/Data_Copy"); ReadCfgEffect.Read("Text/Data/Data_Effect"); ReadCfgRelics.Read("Text/Data/Data_Relics"); ReadCfgMachine.Read("Text/Data/Data_Machine"); ReadCfgActorGroup.Read("Text/Data/Data_ActorGroup"); ReadCfgActor.Read("Text/Data/Data_Actor"); ReadCfgActorRace.Read("Text/Data/Data_ActorRace"); ReadCfgActorModel.Read("Text/Data/Data_ActorModel"); ReadCfgStore.Read("Text/Data/Data_Store"); ReadCfgStoreType.Read("Text/Data/Data_StoreType"); ReadCfgPet.Read("Text/Data/Data_Pet"); ReadCfgPetLevel.Read("Text/Data/Data_PetLevel"); ReadCfgPartner.Read("Text/Data/Data_Partner"); ReadCfgPartnerLevel.Read("Text/Data/Data_PartnerLevel"); ReadCfgPartnerWake.Read("Text/Data/Data_PartnerWake"); ReadCfgPartnerAdvance.Read("Text/Data/Data_PartnerAdvance"); ReadCfgPartnerWash.Read("Text/Data/Data_PartnerWash"); ReadCfgPartnerFetter.Read("Text/Data/Data_PartnerFetter"); ReadCfgPartnerStar.Read("Text/Data/Data_PartnerStar"); ReadCfgTask.Read("Text/Data/Data_Task"); ReadCfgAdventure.Read("Text/Data/Data_Adventure"); ReadCfgSkillTalent.Read("Text/Data/Data_SkillTalent"); ReadCfgMine.Read("Text/Data/Data_Mine"); ReadCfgSkill.Read("Text/Data/Data_Skill"); ReadCfgVideo.Read("Text/Data/Data_Video"); ReadCfgDialogue.Read("Text/Data/Data_Dialogue"); ActBuffSystem.Read("Text/Buff/Buff"); }