public void Execute(Utility.ComponentContainer components) { // Select a simple weapon var choice = GatewayProvider.Get <Weapon>().SimpleWeapons().ChooseOne(); components.Add(new WeaponProficiency(choice.ProficiencyName)); }
public IActionResult Character(string strategy, int level, string scores) { var build = strategyGateway.Find(strategy); var roller = GatewayProvider.Find <AbilityScoreGenerator>(scores); build.TargetLevel = level; build.AbilityScoreRoller = roller.Generator; var gen = GatewayProvider.Find <CharacterDesigner>(build.Designer); var character = new CharacterSheet(build); gen.ExecuteStep(character); ViewData["character"] = new CharacterSheetTextView(character); ViewData["characterFull"] = character; ViewData["strategy"] = strategy; ViewData["scores"] = scores; ViewData["level"] = level; var saveObj = new YamlObjectStore(); character.Save(saveObj); ViewData["save-data"] = saveObj.WriteToString(); return(View()); }
//protected void grdPaymentMode_RowCommand(object sender, GridViewCommandEventArgs e) //{ // if (e.CommandName != "Sort") // { // int rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex; // string commandName = e.CommandName; // if (commandName != null) // { // if (!(commandName == "Fall")) // { // if (!(commandName == "Rise")) // { // return; // } // } // else // { // if (rowIndex != this.grdPaymentMode.Rows.Count) // { // PaymentModeManage.DescPaymentMode((int)this.grdPaymentMode.DataKeys[rowIndex].Value); // this.BindData(); // } // return; // } // if (rowIndex != 0) // { // PaymentModeManage.AscPaymentMode((int)this.grdPaymentMode.DataKeys[rowIndex].Value); // this.BindData(); // } // } // } //} protected void grdPaymentMode_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#EAFED7';this.style.cursor='pointer';");//#F4F4F4 //当鼠标移走时还原该行的背景色 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor"); if (e.Row.RowIndex % 2 == 0) { e.Row.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#F4F4F4"); } else { e.Row.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#FFFFFF"); } Label label = (Label)e.Row.FindControl("lblGatawayType"); if (label != null) { GatewayProvider provider = PayConfiguration.GetConfig().Providers[label.Text.ToLower()] as GatewayProvider; if (provider != null) { label.Text = provider.DisplayName; } } } }
public void LoadsGatewayForCharacterCreator() { var creatorGateway = GatewayProvider.Get <SilverNeedle.Actions.CharacterGeneration.CharacterDesigner>(); Assert.NotNull(creatorGateway); Assert.True(creatorGateway.Count() > 0); }
private void DoValidate() { PayConfiguration config = PayConfiguration.GetConfig(); NameValueCollection parameters = new NameValueCollection(); parameters.Add(this.Page.Request.Form); parameters.Add(this.Page.Request.QueryString); string tmpGatewayName = this.Page.Request.QueryString[Globals.GATEWAY_KEY]; if (string.IsNullOrEmpty(tmpGatewayName)) { this.ResponseStatus(true, "gatewaynotfound"); return; } this.GatewayName = tmpGatewayName.ToLower(); GatewayProvider provider = config.Providers[this.GatewayName] as GatewayProvider; if (provider == null) { this.ResponseStatus(true, "gatewaynotfound"); return; } this.Notify = NotifyQuery.Instance(provider.NotifyType, parameters); if (this.isBackRequest) { this.Notify.ReturnUrl = Globals.FullPath(string.Format(Globals.PAYMENT_RETURN_URL, this.GatewayName)); } this.RechargeId = long.Parse(this.Notify.GetOrderId(), CultureInfo.InvariantCulture); this.Amount = this.Notify.GetOrderAmount(); this.RechargeRequest = PaymentModeManage.GetRechargeRequest(this.RechargeId); if (this.RechargeRequest == null) { this.ResponseStatus(true, "success"); } else { this.Amount = this.RechargeRequest.RechargeBlance; this.paymode = PaymentModeManage.GetPaymentModeByName(this.RechargeRequest.PaymentGateway); if (this.paymode == null) { this.ResponseStatus(true, "gatewaynotfound"); } else { PayeeInfo payee = new PayeeInfo { EmailAddress = this.paymode.EmailAddress, Partner = this.paymode.Partner, Password = this.paymode.Password, PrimaryKey = this.paymode.SecretKey, SecondKey = this.paymode.SecondKey, SellerAccount = this.paymode.MerchantCode }; this.Notify.PaidToIntermediary += new NotifyEventHandler(this.notify_PaidToIntermediary); this.Notify.PaidToMerchant += new NotifyEventHandler(this.notify_PaidToMerchant); this.Notify.NotifyVerifyFaild += new NotifyEventHandler(this.notify_NotifyVerifyFaild); this.Notify.VerifyNotify(0x7530, payee); } } }
public CreateFacialFeatures() { hairStyles = GatewayProvider.Get <HairStyle>(); hairColors = GatewayProvider.Get <HairColor>(); facialHair = GatewayProvider.Get <FacialHair>(); eyeColors = GatewayProvider.Get <EyeColor>(); }
public IActionResult Index() { var strategies = strategyGateway.All().OrderBy(x => x.Name); ViewData["Strategies"] = strategies.ToArray(); ViewData["ScoreGenerators"] = GatewayProvider.All <AbilityScoreGenerator>(); return(View()); }
private static void RegisterSupportedHelpers() { helpers.Add(new ChooseDescriptor()); helpers.Add(new ChooseWordFromGatewayObject <Color>(GatewayProvider.Get <Color>())); helpers.Add(new ChooseWordFromGatewayObject <Gem>(GatewayProvider.Get <Gem>())); helpers.Add(new ChooseWordFromGatewayObject <Occupation>(GatewayProvider.Get <Occupation>())); helpers.Add(SelectCharacterFavoriteColors.CreateAndRegister()); }
private void StockShop() { var armors = GatewayProvider.All <Armor>(); var masterwork = armors.Select(x => new MasterworkArmor(x)); var total = armors.Concat <IArmor>(masterwork); StockShop(total); }
private CharacterDesigner FindDesigner(string name) { if (gateway == null) { gateway = GatewayProvider.Get <CharacterDesigner>(); } return(gateway.Find(designerName)); }
private EntityGateway <Weapon> GetWeapons() { if (weaponsGateway == null) { weaponsGateway = GatewayProvider.Get <Weapon>(); } return(weaponsGateway); }
private void StockShop() { var weapons = GatewayProvider.All <Weapon>(); var masterwork = weapons.Select(x => new MasterworkWeapon(x)); var magical = weapons.Select(x => new MagicWeapon(x, Randomly.Range(1, 6))); var total = weapons.Concat <IWeapon>(masterwork).Concat <IWeapon>(magical); StockShop(total); }
public void LoadAndAttemptToAddAllClasses() { var classes = GatewayProvider.All <Class>(); foreach (var c in classes) { var bob = CharacterTestTemplates.AverageBob().WithSkills(); bob.SetClass(c); } }
public void TestAllDomainsLoadAndAddProperly() { var domains = GatewayProvider.All <Domain>(); foreach (var d in domains) { var character = CharacterTestTemplates.Cleric(); character.Add(d); } }
public IActionResult Settlement(string strategy) { var strat = strategyGateway.Find(strategy); var settlement = new Settlement(strat); var settlementBuilder = GatewayProvider.Find <SettlementDesigner>("create-settlement"); settlementBuilder.Execute(settlement); this.ViewData["settlement"] = settlement; this.ViewData["strategy"] = strategy; return(this.View()); }
public void LoadAndRunAllDesignersToLevel20() { var strategies = GatewayProvider.All <CharacterStrategy>(); foreach (var strat in strategies) { ShortLog.DebugFormat("Validating Strategy: {0}", strat.Name); strat.TargetLevel = 20; var gen = GatewayProvider.Find <CharacterDesigner>(strat.Designer); var character = new CharacterSheet(strat); gen.ExecuteStep(character); } }
public void Execute(Settlement settlement) { var strategy = settlement.Get <SettlementStrategy>(); int target = Randomly.Range(strategy.MinimumPopulation, strategy.MaximumPopulation); for (int count = 0; count < target; count++) { var inhabitantStrategy = GatewayProvider.Find <CharacterStrategy>("inhabitant"); var designer = GatewayProvider.Find <CharacterDesigner>(inhabitantStrategy.Designer); var inhabitant = new CharacterSheet(inhabitantStrategy); designer.ExecuteStep(inhabitant); settlement.AddInhabitant(inhabitant); } }
public override void DataBind() { PayConfiguration config = PayConfiguration.GetConfig(); GatewayProvider provider = null; for (int i = 0; i < config.Keys.Count; i++) { provider = config.Providers[config.Keys[i]] as GatewayProvider; this.Items.Add(new ListItem(provider.DisplayName, provider.Name)); } if (this.AllowNull) { this.Items.Insert(0, new ListItem(this.NullToDisplay, "")); } }
public IEnumerable <Feat> Load(IObjectStore configuration) { var craftsmanFeats = new List <Feat>(); var skills = GatewayProvider.Get <Skill>().Where(x => x.IsProfessionSkill || x.IsCraftSkill); foreach (var skl in skills) { var yaml = configuration.GetString("loader-template"); yaml = yaml.Formatted(skl.Name); var crft = new Feat(yaml.ParseYaml()); craftsmanFeats.Add(crft); } return(craftsmanFeats); }
public virtual void ProcessRequest(HttpContext context) { //支付ID int paymentModeId = Globals.SafeInt(context.Request.QueryString["modeId"], 0); //充值金额 decimal balance = Globals.SafeDecimal(context.Request.QueryString["blance"], 0M); //参数 NULL ERROR返回首页 if ((paymentModeId == 0) || (balance == 0M)) { //Add ErrorLog.. return; } T user = GetCurrentUser(context); PayConfiguration config = PayConfiguration.GetConfig(); PaymentModeInfo paymentMode = PaymentModeManage.GetPaymentModeById(paymentModeId); GatewayProvider provider = config.Providers[paymentMode.Gateway.ToLower()] as GatewayProvider; //计算支付手续费 decimal payCharge = paymentMode.CalcPayCharge(balance); #warning 未支持多币种支付手续费 //根据多币种货币换算, 计算手续费 //decimal payCharge = Sales.ScaleMoney(paymentMode.CalcPayCharge(balance)); if (provider != null) { RechargeRequestInfo info2 = null; info2 = new RechargeRequestInfo { TradeDate = DateTime.Now, RechargeBlance = balance, UserId = user.UserId, PaymentGateway = paymentMode.Gateway }; info2.RechargeId = PaymentModeManage.AddRechargeBalance(info2); if (info2.RechargeId > 0L) { PaymentRequest.Instance( provider.RequestType, this.GetPayee(paymentMode), this.GetGateway(paymentMode.Gateway.ToLower()), this.GetTrade(info2, payCharge, user) ).SendRequest(); } } }
public IEnumerable <Feat> Load(IObjectStore configuration) { var skillFocuses = new List <SkillFocus>(); //Set one up as the "Generic" one for use in trait situations var skillFocusPrimary = new SkillFocus(configuration); var skills = GatewayProvider.All <Skill>(); skillFocuses.Add(skillFocusPrimary); foreach (var skl in skills) { var copy = skillFocusPrimary.Copy() as SkillFocus; copy.SetSkillFocus(skl.Name); copy.Tags.Add(FeatToken.IGNORE_GENERIC_TAG); skillFocuses.Add(copy); } return(skillFocuses); }
public bool IsProficient(string proficiencyName) { //Do a quick string check... foreach (var prof in proficiencyList) { if (prof.EqualsIgnoreCase(proficiencyName)) { return(true); } } var equip = GatewayProvider.Get <Weapon>().Where(x => x.Name.ContainsIgnoreCase(proficiencyName)); foreach (var w in equip) { if (IsProficient(w)) { return(true); } } return(false); }
public IActionResult Index() { var namer = new NameCharacter(); var races = GatewayProvider.Get <Race>().All(); var number = 5; var results = new List <NamesViewModel>(); //Foreach race and gender make a collection of names foreach (var r in races) { foreach (var g in EnumHelpers.GetValues <Gender>()) { var genderRaceNames = new NamesViewModel(r.Name, g); for (int i = 0; i < number; i++) { var name = namer.CreateFullName(g, r.Name); genderRaceNames.Names.Add(name); } results.Add(genderRaceNames); } } ViewData["names"] = results; return(View()); }
public void Initialize(ComponentContainer components) { this.School = GatewayProvider.All <School>().ChooseOne(); }
public PurchaseClothing() { clothing = GatewayProvider.Get <Clothes>(); }
public WandCreator() { spells = GatewayProvider.Get <Spell>(); spellLists = GatewayProvider.Get <SpellList>(); }
public SpontaneousCasting(IObjectStore configuration) : this(configuration, GatewayProvider.Get <SpellList>()) { }
protected virtual void DoValidate() { PayConfiguration config = PayConfiguration.GetConfig(); NameValueCollection parameters = new NameValueCollection(); parameters.Add(this.Page.Request.Form); parameters.Add(this.Page.Request.QueryString); string tmpGatewayName = this.Page.Request.Params[Globals.GATEWAY_KEY]; if (string.IsNullOrEmpty(tmpGatewayName)) { this.ResponseStatus(false, "gatewaynotfound"); return; } this.GatewayName = tmpGatewayName.ToLower(); GatewayProvider provider = config.Providers[this.GatewayName] as GatewayProvider; if (provider == null) { this.ResponseStatus(false, "gatewaynotfound"); return; } this.Notify = NotifyQuery.Instance(provider.NotifyType, parameters); if (this.isBackRequest) { this.Notify.ReturnUrl = Globals.FullPath(string.Format(Option.ReturnUrl, this.GatewayName)); } this.Amount = this.Notify.GetOrderAmount(); this.OrderId = this.Notify.GetOrderId(); this.Order = this.GetOrderInfo(this.OrderId); if (this.Order == null) { this.ResponseStatus(false, "ordernotfound"); } else if (this.Order.PaymentStatus == PaymentStatus.Prepaid) { this.ResponseStatus(true, "success"); } else { //设置支付网关生成的订单ID this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId(); PaymentModeInfo paymentMode = this.GetPaymentMode(this.Order.PaymentTypeId); if (paymentMode == null) { this.ResponseStatus(false, "gatewaynotfound"); } else { #region 测试模式 //DONE: 测试模式埋点 if (Globals.IsPaymentTestMode) { string sign = this.Page.Request.Params["sign"]; if (string.IsNullOrWhiteSpace(sign)) { this.ResponseStatus(false, "<TestMode> no sign"); } System.Text.StringBuilder url = new System.Text.StringBuilder( Globals.FullPath(string.Format(Option.ReturnUrl, this.GatewayName))); url.AppendFormat("&out_trade_no={0}", this.OrderId); url.AppendFormat("&total_fee={0}", this.Amount); if (sign != Globals.GetMd5(System.Text.Encoding.UTF8, url.ToString())) { this.ResponseStatus(false, "<TestMode> Unauthorized sign"); } //效验通过 PaidToSite(); return; } #endregion PayeeInfo payee = new PayeeInfo { EmailAddress = paymentMode.EmailAddress, Partner = paymentMode.Partner, Password = paymentMode.Password, PrimaryKey = paymentMode.SecretKey, SecondKey = paymentMode.SecondKey, SellerAccount = paymentMode.MerchantCode }; GatewayInfo getway = new GatewayInfo { ReturnUrl = Option.ReturnUrl, NotifyUrl = Option.NotifyUrl }; this.Notify.NotifyVerifyFaild += new NotifyEventHandler(this.notify_NotifyVerifyFaild); this.Notify.PaidToIntermediary += new NotifyEventHandler(this.notify_PaidToIntermediary); this.Notify.PaidToMerchant += new NotifyEventHandler(this.notify_PaidToMerchant); this.Notify.VerifyNotify(0x7530, payee, getway); } } }
internal GatewayConfig(GatewayProvider provider) { GatewayProvider = provider; }
public ClassOriginStoryCreator() { this.classOrigins = GatewayProvider.Get <ClassOriginGroup>(); }