/// <summary> /// Restore data from the session /// </summary> void ICommitGumpEntity.LoadStateInfo() { m_State = (m_Gump.Session[((ICommitGumpEntity)this).ID] as DirtyState); if (m_State == null) { m_State = new DirtyState(); m_Gump.Session[((ICommitGumpEntity)this).ID] = m_State; m_State.SetValue("Tax", m_Gump.Data.TaxRate); m_State.SetValue("Distribute", false); } }
private void CreateButtons() { //Show votable beneficiaries and a button.. m_BeneficiaryButtons = new ButtonSet ( m_Gump, GetBeneficiaryNames(), 2, 135, 25, 1153, 1150, 270, 115, 10, //Anon methods GO! delegate(int id) { return(id == m_State.GetValue <int>("VotedFor")); }, //Get Status delegate(int id) { if (m_CanVote) { m_State.SetValue("VotedFor", id); } }, //Click delegate(int id) { if (id.Equals(m_State.GetValue <int>("VotedFor"))) { return(271); } else { return(1359); } } //Get label colour ); }
/// <summary> /// Restore data from the session /// </summary> void ICommitGumpEntity.LoadStateInfo() { m_State = (m_Gump.Session[((ICommitGumpEntity)this).ID] as DirtyState); if (m_State == null) { m_State = new DirtyState(); m_Gump.Session[((ICommitGumpEntity)this).ID] = m_State; m_State.SetValue <int>("VotedFor", -1); } }
/// <summary> /// Handle user response /// </summary> /// <param name="sender"></param> /// <param name="info"></param> /// <returns></returns> CommitGumpBase.GumpReturnType ICommitGumpEntity.OnResponse(Server.Network.NetState sender, RelayInfo info) { //Only the leader can change stuff here if (!ReferenceEquals(m_Gump.Data.CityLeader, sender.Mobile) && sender.Mobile.AccessLevel <= AccessLevel.Player) { return(GumpReturnType.None); } switch ((Buttons)info.ButtonID) { case Buttons.btnLowerTax: { if (m_State.GetValue <double>("Tax") > 0.00) { m_State.SetValue("Tax", m_State.GetValue <double>("Tax") - 0.01); } break; } case Buttons.btnRasieTax: { if (m_State.GetValue <double>("Tax") < 0.5) { m_State.SetValue("Tax", m_State.GetValue <double>("Tax") + 0.01); } break; } case Buttons.btnDistributeTreasury: { //Toggle distribution flag m_State.SetValue("Distribute", !m_State.GetValue <bool>("Distribute")); return(GumpReturnType.None); } default: break; } return(CommitGumpBase.GumpReturnType.None); }
/// <summary> /// Restore data from the session /// </summary> void ICommitGumpEntity.LoadStateInfo() { m_State = (m_Gump.Session[((ICommitGumpEntity)this).ID] as DirtyState); if (m_State == null) { m_State = new DirtyState(); m_Gump.Session[((ICommitGumpEntity)this).ID] = m_State; m_State.SetValue("Type", GuardPost.GuardType); KinCityData data = KinCityManager.GetCityData(GuardPost.City); if (data == null) { return; } KinCityData.BeneficiaryData bdata = data.BeneficiaryDataList.Find(delegate(KinCityData.BeneficiaryData b) { return(b.Pm == GuardPost.Owner); }); if (bdata == null && m_Gump.From.AccessLevel <= AccessLevel.Player) { return; } m_State.SetValue("Slots", GetSlotsAvailable()); m_State.SetValue("Target", GuardPost.FightMode); m_State.SetValue("Speed", GuardPost.HireSpeed); } }
/// <summary> /// Restore data from the session /// </summary> void ICommitGumpEntity.LoadStateInfo() { m_State = (m_Gump.Session[((ICommitGumpEntity)this).ID] as DirtyState); if (m_State == null) { m_State = new DirtyState(); m_Gump.Session[((ICommitGumpEntity)this).ID] = m_State; m_State.SetValue<int>("VotedFor", -1); } }
/// <summary> /// Restore data from the session /// </summary> void ICommitGumpEntity.LoadStateInfo() { m_State = (m_Gump.Session[((ICommitGumpEntity)this).ID] as DirtyState); if (m_State == null) { m_State = new DirtyState(); m_Gump.Session[((ICommitGumpEntity)this).ID] = m_State; m_State.SetValue("Type",GuardPost.GuardType); KinCityData data = KinCityManager.GetCityData(GuardPost.City); if (data == null) return; KinCityData.BeneficiaryData bdata = data.BeneficiaryDataList.Find(delegate(KinCityData.BeneficiaryData b) { return b.Pm == GuardPost.Owner; }); if (bdata == null && m_Gump.From.AccessLevel <= AccessLevel.Player ) return; m_State.SetValue("Slots",GetSlotsAvailable()); m_State.SetValue("Target", GuardPost.FightMode); m_State.SetValue("Speed", GuardPost.HireSpeed); } }
void ICommitGumpEntity.Create() { if (GuardPost.Owner == null) { return; } m_Gump.AddPage(0); m_Gump.AddImage(486, 28, 2623); m_Gump.AddImage(36, 1, 10861); m_Gump.AddImage(6, 33, 2623); m_Gump.AddImage(6, 242, 2623); m_Gump.AddImage(6, 15, 2620); m_Gump.AddImage(219, 14, 2621); m_Gump.AddImage(140, 33, 2623); m_Gump.AddImage(139, 242, 2623); m_Gump.AddImage(6, 452, 2626); m_Gump.AddImage(213, 462, 2621); m_Gump.AddImage(469, 451, 2628); m_Gump.AddImage(470, 14, 2622); m_Gump.AddImage(486, 41, 2623); m_Gump.AddImage(485, 243, 2623); m_Gump.AddImage(26, 14, 2621); m_Gump.AddImage(23, 462, 2621); m_Gump.AddAlphaRegion(493, 14, 22, 463); m_Gump.AddBackground(16, 25, 470, 440, 9270); m_Gump.AddAlphaRegion(8, 473, 499, 8); m_Gump.AddButton(401, 417, 247, 248, (int)Buttons.btnMenuMainOK, GumpButtonType.Reply, 0); m_Gump.AddHtml(45, 46, 412, 19, @"<basefont color=#FFCC00><center>Guard Post Customisation</basefont></center>", (bool)false, (bool)false); m_Gump.AddHtml(60, 76, 205, 314, "<basefont color=white><center>Guard Type</center></basefont>", (bool)false, (bool)false); m_Gump.AddHtml(286, 76, 199, 314, "<basefont color=white><center>Hire Rate</center></basefont>", (bool)false, (bool)false); //For the guards we could just use the enum directly but in this case i want to sort the guards by their cost type first. //And also possibly exclude guard types from this particular Kin. m_Types = KinSystem.GetEligibleGuardTypes(GuardPost.Owner.IOBRealAlignment); m_Types.Sort(delegate(KinFactionGuardTypes x, KinFactionGuardTypes y) //Sort by cost type so they are grouped { int costA = (int)KinSystem.GetGuardCostType(x); int costB = (int)KinSystem.GetGuardCostType(y); if (costA < costB) { return(1); } else if (costA == costB) { return(0); } else { return(-1); } } ); List <string> guardTypeStrings = new List <string>(); foreach (KinFactionGuardTypes t in m_Types) { guardTypeStrings.Add(KinSystem.GetEnumTypeDescription <KinFactionGuardTypes>(t)); } //Add complete button set of possible guards, in two columns. Hook response methods up. m_GuardTypeButtons = new ButtonSet ( m_Gump, guardTypeStrings, 2, 135, 25, 1153, 1150, 41, 115, 1000, //Anon methods GO! delegate(int id) { return(m_State.GetValue <KinFactionGuardTypes>("Type").Equals(m_Types[id])); }, //Get Status delegate(int id) { SetGuardType(m_Types[id]); }, //Click delegate(int id) { return(GetGuardTextColour(m_Types[id])); } //Get label colour ); m_Gump.AddHtml(75, 310, 230, 314, string.Format(m_MAINT, GetNextMaintTimeMinutes()), (bool)false, (bool)false); m_Gump.AddHtml(75, 335, 230, 314, string.Format(m_SLOTS, GetSlotTextColour(), m_State.GetValue <int>("Slots")), (bool)false, (bool)false); m_Gump.AddHtml(75, 360, 230, 314, string.Format(m_SILVER, GetSilverTextColour(), GuardPost.Silver), (bool)false, (bool)false); //Defrag creatures and show next hire time if there is no guard currently spawned. GuardPost.Defrag(); if (GuardPost.Creatures.Count == 0) { m_Gump.AddHtml(75, 385, 230, 314, string.Format(m_HIRE, GetNextHireTimeMinutes()), (bool)false, (bool)false); } //Add button set for the FightMode subset we are interested in. m_SpeedButtons = new ButtonSet ( m_Gump, typeof(KinGuardPost.HireSpeeds), 1, 0, 25, 1153, 1150, 340, 115, 2000, //Anon methods GO! delegate(int id) { return(((int)m_State.GetValue <KinGuardPost.HireSpeeds>("Speed")).Equals(id)); }, delegate(int id) { m_State.SetValue("Speed", (KinGuardPost.HireSpeeds)id); }, delegate(int id) { return(1359); } ); m_Gump.AddHtml(286, 200, 199, 314, "<basefont color=white><center>Target Priority</center></basefont>", (bool)false, (bool)false); //Add button set for the FightMode subset we are interested in. m_TargetButtons = new ButtonSet ( m_Gump, typeof(FightModeButtons), 1, 0, 25, 1153, 1150, 340, 230, 3000, //note: these are flags so we give them the highest offset //Anon methods GO! delegate(int id) { return((((int)m_State.GetValue <FightMode>("Target")) & id) != 0); }, delegate(int id) { SetTarget((FightMode)id); }, delegate(int id) { return(1359); } ); /* * m_Gump.AddHtml(286, 310, 199, 314, "<basefont color=white><center>Fight Style</center></basefont>", (bool)false, (bool)false); * * spacer = 315; * * m_Gump.AddLabel(380, spacer += 25, 1359, @"Melee"); * m_Gump.AddButton(340, spacer, 1150, 1153, (int)Buttons.btnStyleMelee, GumpButtonType.Reply, 0); * m_Gump.AddLabel(380, spacer += 25, 1359, @"Magic"); * m_Gump.AddButton(340, spacer, 1150, 1153, (int)Buttons.btnStyleMagic, GumpButtonType.Reply, 0); */ if (m_State.IsValueDirty <KinFactionGuardTypes>("Type") || m_State.IsValueDirty <int>("Slots") || m_State.IsValueDirty <KinGuardPost.HireSpeeds>("Speed") || m_State.IsValueDirty <FightMode>("Target")) { m_Gump.AddHtml(10, 415, 412, 136, m_OK, (bool)false, (bool)false); } }