private void ProcessEffect1(int count, string funcParams) { int totalAddExp = count * int.Parse(funcParams); PlayerHeroLogic playerHero = new PlayerHeroLogic(); playerHero.SetUser(m_UserId).SetHero(m_HeroId); playerHero.AddExp(totalAddExp); }
public override bool TakeAction() { PlayerHeroLogic ph = new PlayerHeroLogic(); ph.SetUser(m_UserId).SetHero(m_RequestPacket.HeroId); foreach (var iteminfo in m_RequestPacket.Items) { ItemListItem item = new ItemListItem() { Id = iteminfo.Type, Count = iteminfo.Count }; DTItem itemData = CacheSet.ItemTable.GetData(item.Id); PlayerPackageLogic pp = new PlayerPackageLogic(); pp.SetUser(m_UserId); if (!pp.DeductInventory(item)) { ErrorCode = (int)ErrorType.RequireNotMet; ErrorInfo = "You have not enough item"; return(false); } switch ((ItemFunctions)itemData.FunctionId) { case ItemFunctions.AddHeroExp: ph.AddExp(int.Parse(itemData.FunctionParams) * item.Count); var heroInfo = ph.GetHeroInfo(); m_ResponsePacket.HeroInfo = new PBLobbyHeroInfo() { Type = heroInfo.HeroType, Level = heroInfo.HeroLv, Exp = heroInfo.HeroExp, Might = heroInfo.Might, }; break; case ItemFunctions.HeroPiece: AddSpirit(item.Count); break; default: break; } m_ResponsePacket.ItemInfo.Add(new PBItemInfo() { Type = item.Id, Count = pp.MyPackage.Inventories[item.Id] }); } return(true); }