private byte[] GenerateSponsoringOrgsExcel(byte[] template, int currentRow, ref int currentColumn) { List <SortMetaDataObject> orgs = new List <SortMetaDataObject>(); foreach (var c in Sorts) { orgs.AddRange(c.SponsoringOrgs); } bool newSheet = SheetSelection.Contains("SponsoringOrgs"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += MetaDataRowCount; } var contactFile = Talon.Excel(orgs) .Template(template) .StartAt(column, row) .Sheet(newSheet ? SponsoringOrgsSheetName : DefaultSheetName) .Name("SponsoringOrgsTable") .Columns(c => { c.Bound(x => x.SortTitle).Title("STI Number and Rev"); c.Bound(x => x.Data).Title("Sponsor"); }); return(contactFile.Export()); }
private byte[] GenerateContactsExcel(byte[] template, int currentRow, ref int currentColumn) { List <ContactObject> contacts = new List <ContactObject>(); foreach (var c in Sorts) { contacts.AddRange(c.Contacts); } bool newSheet = SheetSelection.Contains("Contacts"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += ContactRowCount; } var contactFile = Talon.Excel(contacts) .Template(template) .StartAt(column, row) .Sheet(newSheet ? ContactSheetName : DefaultSheetName) .Name("ContactsTable") .Columns(c => { c.Bound(x => x.SortTitle).Title("STI Number and Rev"); c.Bound(x => x.EmployeeId).Title("Employee ID"); c.Bound(x => x.FullName).Title("Name"); c.Bound(x => x.ContactTypeDisplayName).Title("Contact Type"); }); return(contactFile.Export()); }
public async Task Create(string connectionId) { nomerTalon++; Talon talon = new Talon { NomerPP = nomerTalon.ToString(), AcceptFlag = false, TalonTime = DateTime.Now.ToLocalTime() }; TalonQueue.EnqueueTalon(talon); //Отправка талона на ИТ await hubContext.Clients.AllExcept(connectionId).SendAsync("AddTalon", $"Талон № : {talon.NomerPP} Время регистрации: {talon.TalonTime}.", talon.NomerPP); //Получение талона await hubContext.Clients.Client(connectionId).SendAsync("Notify", talon.NomerPP); // Количество активных Талонов Оператор int tWait = TalonQueue.GetTalonLength(); int tAccept = TalonServ.talonList.Count; int tAll = tWait + tAccept; await hubContext.Clients.AllExcept(connectionId).SendAsync("TalonCount", tWait.ToString(), tAccept.ToString(), tAll.ToString()); await hubContext.Clients.Client(connectionId).SendAsync("TalonCount", TalonQueue.GetTalonLength().ToString()); }
private byte[] GenerateKeywordsExcel(byte[] template, int currentRow, ref int currentColumn) { List <MetaDataObject> words = new List <MetaDataObject>(); foreach (var c in Mains) { words.AddRange(c.KeyWordList); } bool newSheet = SheetSelection.Contains("Keywords"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += MetaDataRowCount; } var data = Talon.Excel(words) .Template(template) .StartAt(column, row) .Sheet(newSheet ? KeywordsSheetName : DefaultSheetName) .Name("KeywordsTable") .Columns(c => { c.Bound(x => x.MainTitle).Title("STI Number and Rev"); c.Bound(x => x.Data).Title("Keyword"); }); return(data.Export()); }
public async Task Call(string connectionId) { Talon talon = TalonQueue.PeekTalon(); //Вызывается Талон в ИТ await hubContext.Clients.AllExcept(connectionId).SendAsync("CallTalon", talon.NomerPP); await hubContext.Clients.Client(connectionId).SendAsync("CallTalon", talon.NomerPP); }
public GridRowPatientToday(int number, Talon talon) { this.number = number.ToString(); this.fio = talon.Patient.FIO; var date = talon.Time; this.data = date.Date.ToString(); this.time = String.Format("{0}:{1}", talon.Time.Hour, talon.Time.Minute); }
protected override async Task Delete(byte[] id) { using (var rep = new TalonRep()) { var conv = new ModelsForWpf.Converter <ModelsForWpf.Talon>(); var us = new Talon(conv.ByteArrayToObject(id)); await rep.Delete(us.Id); } }
protected override byte[] GetItem(byte[] id) { using (var rep = new TalonRep()) { var conv = new ModelsForWpf.Converter <ModelsForWpf.Talon>(); var us = new Talon(conv.ByteArrayToObject(id)); return(conv.ObjectToByteArray(Converter.ToTalon(rep.GetItem(us.Id)))); } }
private void TalonSelectExecute(Talon talon) { if (LastSelectedTalon != 0) { Talons.First(el => el.Id == LastSelectedTalon).IsSelected = false; } talon.IsSelected = true; LastSelectedTalon = talon.Id; }
static public ModelsForWpf.Talon ToTalon(Talon talon) { var ret = new ModelsForWpf.Talon(talon.Id, talon.One, talon.Two, null, null); using (var rep = new CarRep()) ret.Car = ToCar(rep.GetItem(talon?.Car_Id ?? -1)); using (var rep = new SlotRep()) ret.Slot = ToSlot(rep.GetItem(talon?.Slot_Id ?? -1)); return(ret); }
protected override async Task Update(byte[] item) { using (var rep = new TalonRep()) { var conv = new ModelsForWpf.Converter <ModelsForWpf.Talon>(); var us = new Talon(conv.ByteArrayToObject(item)); await rep.Update(us); await rep.Save(); } }
private byte[] GenerateFundingExcel(byte[] template, int currentRow, ref int currentColumn) { List <FundingObject> funding = new List <FundingObject>(); foreach (var c in Mains) { funding.AddRange(c.Funding); } bool newSheet = SheetSelection.Contains("Funding"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += FundingRowCount; } var data = Talon.Excel(funding) .Template(template) .StartAt(column, row) .Sheet(newSheet ? FundingSheetName : DefaultSheetName) .Name("FundingTable") .Columns(c => { c.Bound(x => x.MainTitle).Title("STI Number and Rev"); c.Bound(x => x.Year).Title("Fiscal Year"); c.Bound(x => x.FundingType).Title("Funding Source"); c.Bound(x => x.FundingOrgName).Title("Funding Org"); c.Bound(x => x.Percent).Title("Percent"); c.Bound(x => x.ContractNumber).Title("Contract Number"); c.Bound(x => x.ProjectArea).Title("Project Area"); c.Bound(x => x.DoeFundingCategory).Title("DOE Program"); c.Bound(x => x.MilestoneTrackingNumber).Title("Milestone Tracking Number"); c.Bound(x => x.GrantNumber).Title("Grant"); c.Bound(x => x.TrackingNumber).Title("Tracking Number"); c.Bound(x => x.ProjectNumber).Title("Project Number"); c.Bound(x => x.PrincipalInvEmployeeId).Title("Principal Investigator Employee ID"); c.Bound(x => x.PrincipalInvName).Title("Principal Investigator"); c.Bound(x => x.OtherDescription).Title("Other Description"); c.Bound(x => x.SppFundingName).Title("SPP Category"); c.Bound(x => x.SppApproved).Title("SPP Approved"); c.Bound(x => x.ApproveNoReason).Title("SPP Not Approved Reason"); c.Bound(x => x.FederalAgency).Title("SPP Federal Agency"); c.Bound(x => x.SppCountry).Title("SPP Foreign Institution Country"); c.Bound(x => x.AdditionalInfo).Title("SPP Foreign Institution Additional Info"); }); return(data.Export()); }
public void TestSpinUpTime() { using (Talon t = new Talon(0)) using (Counter c = new Counter(0)) { ISimSpeedController s = new SimPWMController(0); //IServoFeedback f = new SimCounter(0); DCMotor motor = DCMotor.MakeCIM(); double inertia = 0.005; double deaccel = -80.0; } }
public ActionResult PendingReviewExcel() { byte[] excelFile = Talon.Excel(PendingReviewReport.GetPendingReviews().OrderByDescending(n => n.Age)).Columns(c => { c.Bound(m => m.ArtifactDisplayTitle).Title("STI Number and Rev").Width(100); c.Bound(m => m.ReviewerName).Title("Reviewer").Width(150); c.Bound(m => m.ReviewerOrg).Title("Reviewer Org").Width(150); c.Bound(m => m.ReviewerTypeDisplayName).Title("Review Type").Width(150); c.Bound(m => m.ReviewStatusDisplayName).Title("Review Status").Width(100); c.Bound(m => m.ReviewStartDateStr).Title("Review Start Date").Width(100); c.Bound(m => m.Age).Title("Age").Width(100); }).Export(); return(File(excelFile, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"LRS_PendingReviews_{DateTime.Now:MM-dd-yyyy}.xlsx")); }
private byte[] GenerateReviewerHistoryExcel(byte[] template, int currentRow, ref int currentColumn) { List <ReviewHistoryObject> reviewers = new List <ReviewHistoryObject>(); foreach (var c in Mains) { reviewers.AddRange(c.ReviewHistory); } bool newSheet = SheetSelection.Contains("ReviewerHistory"); int row = 2; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += ReviewerHistoryRowCount; } var data = Talon.Excel(reviewers) .Template(template) .StartAt(column, row) .Sheet(newSheet ? ReviewerHistorySheetName : DefaultSheetName) .Name("ReviewerHistoryTable") .Columns(c => { c.Bound(x => x.MainTitle).Title("STI Number and Rev"); c.Bound(x => x.ReviewerName).Title("Reviewer"); c.Bound(x => x.ReviewerTypeDisplayName).Title("Reviewer Type"); c.Bound(x => x.ReviewDateStr).Title("Date Reviewed"); c.Bound(x => x.ReviewStatusTxt).Title("Last Status"); c.Bound(x => x.StatusDateStr).Title("Status Date"); c.Bound(x => x.NumberPagesStr).Title("Number Pages"); c.Bound(x => x.HistoryDateStr).Title("Date Moved to History"); }); if (newSheet) { data.SetValue(1, 1, "Reviewers"); } return(data.Export()); }
private byte[] GenerateReviewerHistoryCommentsExcel(byte[] template, int currentRow, ref int currentColumn) { List <ReviewCommentHistoryObject> reviewercomments = new List <ReviewCommentHistoryObject>(); foreach (var c in Mains) { reviewercomments.AddRange(ReviewCommentHistoryObject.GetReviewComments(c.MainId.Value)); } bool newSheet = SheetSelection.Contains("ReviewerHistory"); int row = 2; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += ReviewerCommentsRowCount; } else { column += ReviewerHistoryRowCount; } var data = Talon.Excel(reviewercomments) .Template(template) .StartAt(column, row) .Sheet(newSheet ? ReviewerHistorySheetName : DefaultSheetName) .Name("ReviewerHistoryCommentsTable") .Columns(c => { c.Bound(x => x.MainTitle).Title("STI Number and Rev"); c.Bound(x => x.ReviewerName).Title("Reviewer"); c.Bound(x => x.EntryDateStr).Title("Comment Date"); c.Bound(x => x.Comment).Title("Comment"); }); if (newSheet) { data.SetValue(column, 1, "Comments"); } return(data.Export()); }
public async Task Next(string connectionId) { Talon acceptTalon = TalonQueue.DequeueTalon(); acceptTalon.AcceptFlag = true; acceptTalon.AcceptTime = DateTime.Now.ToLocalTime(); TalonServ.talonList.Add(acceptTalon); int tWait = TalonQueue.GetTalonLength(); int tAccept = TalonServ.talonList.Count; int tAll = tWait + tAccept; // Количество активных Талонов await hubContext.Clients.Client(connectionId).SendAsync("TalonCount", tWait.ToString(), tAccept.ToString(), tAll.ToString()); await hubContext.Clients.AllExcept(connectionId).SendAsync("TalonCount", TalonQueue.GetTalonLength().ToString()); }
private void GetTalonButton_Click(object sender, EventArgs e) { var date = dateTime.Value; var hours = (int)HousUpDown.Value; var minutes = (int)minuteUpDown.Value; var time = new DateTime(date.Date.Year, date.Date.Month, date.Date.Day, hours, minutes, 0); var talon = new Talon(time, Session.Auth as Patient, (specialistBox.SelectedItem as Specialist)); if (TalonRepository.Create(talon) == TalonAddStatus.Created) { MessageBox.Show("Вы зписаны на приём"); Utilites.NextForm(new MainPatForm()); } else if (TalonRepository.Create(talon) == TalonAddStatus.PatientBusy) MessageBox.Show("Вы уже записаны на приём на это время"); else if (TalonRepository.Create(talon) == TalonAddStatus.SpecialistBusy) { MessageBox.Show("Данный специалист не сможет принять вас в это время"); } }
public void TestMotorSafetyFeed() { using (Talon t = new Talon(0)) { t.SafetyEnabled = true; t.Expiration = 0.05; t.Set(1.0); double valAfterSet = SimData.PWM[0].Value; bool aliveAfterSet = t.Alive; UpdateData(); t.Set(1.0); UpdateData(); t.Set(1.0); UpdateData(); t.Set(1.0); UpdateData(); Thread.Sleep(100); t.Set(1.0); UpdateData(); t.Set(1.0); UpdateData(); t.Set(1.0); UpdateData(); t.Set(1.0); UpdateData(); t.Set(1.0); UpdateData(); t.Set(1.0); UpdateData(); double valAfterSleep = SimData.PWM[0].Value; bool aliveAfterSleep = t.Alive; Assert.That(valAfterSet, Is.EqualTo(1.0).Within(0.0001)); Assert.That(aliveAfterSet, Is.True); Assert.That(valAfterSleep, Is.EqualTo(1.0).Within(0.001)); Assert.That(aliveAfterSleep, Is.True); } }
private byte[] GenerateReviewersExcel(byte[] template, int currentRow, ref int currentColumn) { List <ReviewObject> words = new List <ReviewObject>(); foreach (var c in Sorts) { words.AddRange(c.Reviewers); } bool newSheet = SheetSelection.Contains("Reviewers"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += ReviewersRowCount; } var contactFile = Talon.Excel(words) .Template(template) .StartAt(column, row) .Sheet(newSheet ? ReviewersSheetName : DefaultSheetName) .Name("ReviewersTable") .Columns(c => { c.Bound(x => x.SortTitle).Title("STI Number and Rev"); c.Bound(x => x.Reviewer).Title("Reviewer"); c.Bound(x => x.ReviewerType).Title("Reviewer Type"); c.Bound(x => x.ReviewDate).Title("Review Date"); c.Bound(x => x.Approval).Title("Approved"); c.Bound(x => x.Reason).Title("Reason"); c.Bound(x => x.Comments).Title("Comments"); }); return(contactFile.Export()); }
private byte[] GenerateContactsExcel(byte[] template, int currentRow, ref int currentColumn) { List <ContactObject> contacts = new List <ContactObject>(); foreach (var c in Mains) { contacts.AddRange(c.Contacts); } bool newSheet = SheetSelection.Contains("Contacts"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += ContactRowCount; } var data = Talon.Excel(contacts) .Template(template) .StartAt(column, row) .Sheet(newSheet ? ContactSheetName : DefaultSheetName) .Name("ContactsTable") .Columns(c => { c.Bound(x => x.MainTitle).Title("STI Number and Rev"); c.Bound(x => x.EmployeeId).Title("Employee ID"); c.Bound(x => x.Name).Title("Name"); c.Bound(x => x.Phone).Title("Phone #"); c.Bound(x => x.WorkOrg).Title("Org"); c.Bound(x => x.Location).Title("Location"); c.Bound(x => x.OrcidId).Title("Orcid ID"); }); return(data.Export()); }
private byte[] GenerateAuthorsExcel(byte[] template, int currentRow, ref int currentColumn) { List <AuthorObject> authors = new List <AuthorObject>(); foreach (var c in Mains) { authors.AddRange(c.Authors); } bool newSheet = SheetSelection.Contains("Authors"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += AuthorRowCount; } var data = Talon.Excel(authors) .Template(template) .StartAt(column, row) .Sheet(newSheet ? AuthorsSheetName : DefaultSheetName) .Name("AuthorsTable") .Columns(c => { c.Bound(x => x.MainTitle).Title("STI Number and Rev"); c.Bound(x => x.EmployeeId).Title("Employee ID"); c.Bound(x => x.Name).Title("Name"); c.Bound(x => x.Affiliation).Title("Affiliation"); c.Bound(x => x.OrcidId).Title("Orcid ID"); c.Bound(x => x.IsPrimary).Title("Primary"); }); return(data.Export()); }
private byte[] GenerateIntellectualPropertyExcel(byte[] template, int currentRow, ref int currentColumn) { List <IntellectualPropertyObject> intellect = new List <IntellectualPropertyObject>(); foreach (var c in Mains) { intellect.AddRange(c.Intellectuals); } bool newSheet = SheetSelection.Contains("Intellectual"); int row = 1; int column = 1; if (!newSheet) { row = currentRow; column = currentColumn; currentColumn += IntellectualProprtyRowCount; } var data = Talon.Excel(intellect) .Template(template) .StartAt(column, row) .Sheet(newSheet ? IntellectualsSheetName : DefaultSheetName) .Name("IntellectualsTable") .Columns(c => { c.Bound(x => x.MainTitle).Title("STI Number and Rev"); c.Bound(x => x.IdrNumber).Title("IDR Number"); c.Bound(x => x.DocketNumber).Title("Docket Number"); c.Bound(x => x.Aty).Title("Aty"); c.Bound(x => x.Ae).Title("Ae"); c.Bound(x => x.Title).Title("Title"); }); return(data.Export()); }
public static void Main() { /* Initialize Display */ CTRE.Gadgeteer.Module.DisplayModule.LabelSprite titleDisplay, pitchDisplay, outputDisplay, PID_PDisplay, PID_IDisplay, PID_DDisplay, PIDScalerDisplay, PIDSelectDisplay, batteryDisplay, trimDisplay; /* State and battery display in the 1st row */ titleDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.Red, 1, 1, 80, 15); batteryDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.Green, 81, 1, 79, 15); /* Pitch and output display in the 2nd row */ pitchDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.Cyan, 1, 21, 80, 15); outputDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.Cyan, 81, 21, 79, 15); /* PID Scalar and angle Trim display in the 3rd row */ PIDScalerDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.Yellow, 1, 41, 80, 15); trimDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.Blue, 81, 41, 79, 15); /* Gain Display at the bottom */ PID_PDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.White, 1, 61, 90, 15); PID_IDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.White, 1, 81, 90, 15); PID_DDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.White, 1, 101, 90, 15); PIDSelectDisplay = Hardware.Display.AddLabelSprite(Hardware.bigFont, CTRE.Gadgeteer.Module.DisplayModule.Color.Orange, 91, 81, 60, 15); foreach (CTRE.Phoenix.MotorControl.CAN.TalonSRX Talon in Hardware.allTalons) { /* Voltage Compensation on both Talons */ Talon.ConfigVoltageCompSaturation(10.0f, kTimeout); Talon.EnableVoltageCompensation(true); Talon.ConfigVoltageMeasurementFilter(32, kTimeout); Talon.ConfigNominalOutputForward(0, kTimeout); Talon.ConfigNominalOutputReverse(0, kTimeout); Talon.ConfigPeakOutputForward(1, kTimeout); Talon.ConfigPeakOutputReverse(-1, kTimeout); /* Current limiting on both Talons */ Talon.ConfigContinuousCurrentLimit(15, kTimeout); // Configured to desired amperage of current draw Talon.ConfigPeakCurrentLimit(15, kTimeout); // Peak current limit set to 0, current limit when current has excedded continout current limit value Talon.ConfigPeakCurrentDuration(0, kTimeout); // Current limit the moment peak current limit has been met by current limit Talon.EnableCurrentLimit(true); // Enable current limiting /* Change Velocity measurement paramters */ Talon.ConfigVelocityMeasurementPeriod(CTRE.Phoenix.MotorControl.VelocityMeasPeriod.Period_10Ms, kTimeout); Talon.ConfigVelocityMeasurementWindow(32, kTimeout); /* Speed up Feedback status frame of both Talons */ Talon.SetStatusFramePeriod(CTRE.Phoenix.MotorControl.StatusFrame.Status_2_Feedback0_, 10, kTimeout); /* Speed up Status Frame 4, which provides information about battery */ Talon.SetStatusFramePeriod(CTRE.Phoenix.MotorControl.StatusFrameEnhanced.Status_4_AinTempVbat, 10, kTimeout); } /* Speed up Pigeon CAN Frames that are important for the cascade PID loop to operate properly */ Hardware.pidgey.SetStatusFramePeriod(CTRE.Phoenix.Sensors.PigeonIMU_StatusFrame.BiasedStatus_2_Gyro, 5, kTimeout); Hardware.pidgey.SetStatusFramePeriod(CTRE.Phoenix.Sensors.PigeonIMU_StatusFrame.CondStatus_9_SixDeg_YPR, 5, kTimeout); /* Locals used when Gain Scheduling within Balance loop (Inner Loop) */ float tempP = 0; float tempI = 0; float tempD = 0; ServoParameters currentPID = new ServoParameters(); float[] XYZ_Dps = new float[3]; Boolean lowBattery = false; CTRE.Phoenix.Controller.GameControllerValues gamepadValues = new CTRE.Phoenix.Controller.GameControllerValues(); int lastGamepadPOV = 0; float angleTrim = 0; while (true) { /* Check to see if gamepad is connected to enable watchdog (Motor Safety) */ if (Hardware.Gamepad.GetConnectionStatus() == CTRE.Phoenix.UsbDeviceConnection.Connected) { CTRE.Phoenix.Watchdog.Feed(); } /* Pull values from gamepad */ float stick = -1 * Hardware.Gamepad.GetAxis(1); float turn = Hardware.Gamepad.GetAxis(2); CTRE.Phoenix.Util.Deadband(ref stick); //Deadband CTRE.Phoenix.Util.Deadband(ref turn); //Deadband turn *= 0.50f; //Scale turn speed Hardware.Gamepad.GetAllValues(ref gamepadValues); if (gamepadValues.pov == 2 && lastGamepadPOV != 2) { angleTrim++; } else if (gamepadValues.pov == 6 && lastGamepadPOV != 6) { angleTrim--; } lastGamepadPOV = gamepadValues.pov; trimDisplay.SetText("Trm: " + angleTrim); /* Change operation state when Button 1 (X-Button) is pressed */ bool button1 = Hardware.Gamepad.GetButton(1); if (button1 && !lastButton1) { /* Toggle between operation state and clear accumulated values */ OperateState = !OperateState; Iaccum = 0; Iaccum_velocity = 0; } lastButton1 = button1; /* Offset pitch when Button 2 (A-Button) is pressed */ bool button2 = Hardware.Gamepad.GetButton(2); if (button2 && !lastButton2) { /* Update current pitchoffset with new offset */ pitchoffset = 0; pitchoffset = GetPitch(); angleTrim = 0; } lastButton2 = button2; /* Cycle through current PID values [P, I, D] when Button 3 (B-Button) is pressed */ bool button3 = Hardware.Gamepad.GetButton(3); if (button3 && !lastButton3) { /* Select gain to control */ PIDValue++; if (PIDValue > 2) { PIDValue = 0; } } lastButton3 = button3; /* Cycle through PID sets [Soft, Hard, Velocity] when Button 4 (Y-Button) is pressed */ bool button4 = Hardware.Gamepad.GetButton(4); if (button4 && !lastButton4) { PIDCycle++; if (PIDCycle > 2) { PIDCycle = 0; } } lastButton4 = button4; /* Increase the DEC/INC Value for PID Gains by 10x, max of 10.000... when Button 10 (Start-Button) is pressed */ bool button10 = Hardware.Gamepad.GetButton(10); if (button10 && !lastButton10) { /* Increase the increment/decrement value by x10 */ inc_dec *= 10; if (inc_dec >= 100) { inc_dec = 0.001f; } } lastButton10 = button10; PIDScalerDisplay.SetText("" + inc_dec); /* Change the highlighted PID value to inform user which PID is in control */ if (PIDValue == 0) { PID_PDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.White); PID_IDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.Orange); PID_DDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.Orange); } else if (PIDValue == 1) { PID_PDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.Orange); PID_IDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.White); PID_DDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.Orange); } else if (PIDValue == 2) { PID_PDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.Orange); PID_IDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.Orange); PID_DDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.White); } /* Selects PID set to be in control */ if (PIDCycle == 0) { currentPID = BalancePID; PIDSelectDisplay.SetText("Soft"); } else if (PIDCycle == 1) { currentPID = DrivePID; PIDSelectDisplay.SetText("Hard"); } else if (PIDCycle == 2) { currentPID = VelocityPID; PIDSelectDisplay.SetText("Velocity"); } PIDControl(currentPID); PID_PDisplay.SetText("P: " + currentPID.P); PID_IDisplay.SetText("I: " + currentPID.I); PID_DDisplay.SetText("D: " + currentPID.D); ///* Output battery to Display Module */ float vBat = 0; vBat = Hardware.leftTalon.GetBusVoltage(); batteryDisplay.SetText("Bat: " + vBat); if (Hardware.battery.IsLow()) { lowBattery = true; } else { lowBattery = false; } /* If Pigeon is connected and operation state is true, enable balance mode */ if (Hardware.pidgey.GetState() == CTRE.Phoenix.Sensors.PigeonState.Ready && OperateState == true) { manualMode = false; } else { manualMode = true; } /* Velocity PI */ //=============================================================================================================================================// //=============================================================================================================================================// /* Get pitch angular rate */ Hardware.pidgey.GetRawGyro(XYZ_Dps); float pitchRate = XYZ_Dps[0]; float velocityRPM = -(Hardware.leftTalon.GetSelectedSensorVelocity(0) + Hardware.rightTalon.GetSelectedSensorVelocity(0)) * 0.5f * 600 / 4096; float velocityDPS = (velocityRPM) * 6; //RPM converted into DPS /* Velocity setpoint pulled from gamepad throttle joystick */ float velocitySetpoint = -stick * VelocityPID.D; /* Compensate for pitch angular rate when finding velocity */ float wheelVelocity = ((velocityDPS) + pitchRate) / 6 * (float)(System.Math.PI * 6.25f) / 12.00f / 60; //DPS converted into FPS float velocityError = velocitySetpoint - wheelVelocity; Iaccum_velocity += (velocityError * VelocityPID.I); Iaccum_velocity = CTRE.Phoenix.Util.Cap(Iaccum_velocity, accummax_velocity); float pValue_vel = velocityError * VelocityPID.P; float iValue_vel = Iaccum_velocity; float angleSetpoint = pValue_vel + iValue_vel; /* Balance PID, call 4 times per outer call (Cascade PID control) */ //=============================================================================================================================================// //=============================================================================================================================================// for (int i = 0; i < 4; i++) { Hardware.pidgey.GetRawGyro(XYZ_Dps); //Get Angular rate for pitch float currentAngularRate = XYZ_Dps[0] * 0.001f; //Scaled down for easier gain control float currentPitch = GetPitch(); //Get Pitch pitchDisplay.SetText("p: " + currentPitch); //Update Display float targetPitch = angleSetpoint + angleTrim; float pitchError = targetPitch - currentPitch; float deadband = 5.0f; if (currentPitch > (angleTrim - deadband) && currentPitch < (angleTrim + deadband)) { /* Gain schedule when within 5 degrees of current angleTrim */ tempP = BalancePID.P; tempI = BalancePID.I; tempD = BalancePID.D; } else { tempP = DrivePID.P; tempI = DrivePID.I; tempD = DrivePID.D; Iaccum = 0; } Iaccum += pitchError * tempI; Iaccum = CTRE.Phoenix.Util.Cap(Iaccum, accummax); /* Clear accumulator when within zone */ if (currentPitch > -0.5 && currentPitch < 0.5) { Iaccum = 0; } float pValue = (pitchError) * tempP; float iValue = (Iaccum); float dValue = (currentAngularRate) * tempD; float Output = pValue - dValue + iValue; /* Process output */ //=============================================================================================================================================// //=============================================================================================================================================// Output = CTRE.Phoenix.Util.Cap(Output, maxOutput); //cap value to [-1, 1] if (lowBattery) { /* Scale all drivetrain inputs to 25% if battery is low */ batteryDisplay.SetColor(CTRE.Gadgeteer.Module.DisplayModule.Color.Red); Output *= 0.25f; stick *= 0.25f; turn *= 0.25f; } if (manualMode == false) { /* In balance mode, use PI -> PID -> Output */ DrivetrainSet(Output, turn); titleDisplay.SetText("Enabled"); outputDisplay.SetText("Out: " + Output); } else { /* In maual mode/disabled, use joystick -> Output */ DrivetrainSet(stick, turn); titleDisplay.SetText("Disabled"); outputDisplay.SetText("Out: " + stick); } /* Balance CAN Frame */ byte[] frame = new byte[8]; frame[0] = (byte)((int)(pValue * 1000) >> 8); frame[1] = (byte)((int)(pValue * 1000) & 0xFF); frame[2] = (byte)((int)(-dValue * 100000) >> 8); frame[3] = (byte)((int)(-dValue * 100000) & 0xFF); frame[4] = (byte)((int)(iValue * 1000) >> 8); frame[5] = (byte)((int)(iValue * 1000) & 0xFF); frame[6] = (byte)((int)(Output * 1000) >> 8); frame[7] = (byte)((int)(Output * 1000) & 0xFF); ulong data = (ulong)BitConverter.ToUInt64(frame, 0); CTRE.Native.CAN.Send(9, data, 8, 0); } /* Velocity CAN Frame */ byte[] frame2 = new byte[8]; frame2[0] = (byte)((int)(wheelVelocity * 1000) >> 8); frame2[1] = (byte)((int)(wheelVelocity * 1000) & 0xFF); frame2[2] = (byte)((int)(angleSetpoint * 1000) >> 8); frame2[3] = (byte)((int)(angleSetpoint * 1000) & 0xFF); frame2[4] = (byte)((int)(pitchRate * 100) >> 8); frame2[5] = (byte)((int)(pitchRate * 100) & 0xFF); frame2[6] = (byte)((int)(velocityDPS * 100) >> 8); frame2[7] = (byte)((int)(velocityDPS * 100) & 0xFF); ulong data2 = (ulong)BitConverter.ToUInt64(frame2, 0); CTRE.Native.CAN.Send(8, data2, 8, 0); Thread.Sleep(5); } }
public List<BaseItem> GetAllItemsInNpcBag(byte bag, int npcId) { DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_BAGID_PARAMETER, bag); bagIdParameter.DbType = DbType.Byte; DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_NPCID_PARAMETER, npcId); characterIdParameter.DbType = DbType.Int32; List<BaseItem> items = new List<BaseItem>(); _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLNPCITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT); int ordinalITEM_PRICE = reader.GetOrdinal(DbNames.ITEM_PRICE); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_DURABILITY = reader.GetOrdinal(DbNames.ITEM_DURABILITY); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_MAXIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG); int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { BaseItem b = null; int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if(BKind == (byte)bKindWeapons.Hammer && BType == (byte)bType.Weapon) { b = new Hammer(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.Durability = reader.GetInt32(ordinalITEM_DURABILITY); e.MaxDurability = e.Durability; e.Damage = reader.GetInt16(ordinalITEM_DAMAGE); e.Defence = reader.GetInt16(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUETRIES); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = reader.GetByte(ordinalITEM_BAG); b.Slot = reader.GetByte(ordinalITEM_SLOT); b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = reader.GetInt16(ordinalITEM_AMOUNT); b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_PRICE); items.Add(b); } reader.Close(); _db.Close(); return items; }
public static GridRowPatientToday Create(Talon talon, int index) => new GridRowPatientToday(index, talon);
public byte[] GenerateExcelFile() { // Create main export with requested fields. var sortFile = Talon.Excel(Sorts).Name(DefaultSheetName).Sheet(DefaultSheetName).Columns(c => { c.Bound(x => x.TitleStr).Title("STI Number and Rev"); foreach (var column in ColSelection) { switch (column) { case "PublishTitle": c.Bound(x => x.PublishTitle).Title("Title"); break; case "Osti": c.Bound(x => x.OstiId).Title("OSTI ID"); c.Bound(x => x.OstiDate).Title("OSTI Publish Date"); c.Bound(x => x.OstiStatus).Title("OSTI Publish Status"); c.Bound(x => x.OstiStatusMsg).Title("OSTI Publish Message"); break; case "PublicationDate": c.Bound(x => x.PublicationDate).Title("Publication/Issue Date"); break; case "ProductType": c.Bound(x => x.ProductTypeDisplayName).Title("Artifact Type"); break; case "ReportNumbers": c.Bound(x => x.ReportNumbers).Title("Report/Product Number(s)"); break; case "Country": c.Bound(x => x.Country).Title("Country of Origin/Publication"); break; case "Language": c.Bound(x => x.Language).Title("Publication Language"); break; case "AccessLimitation": c.Bound(x => x.AccessLimitationDisplayName).Title("Access Limitation"); break; case "Abstract": c.Bound(x => x.AbstractWithAccessCheck).Title("Description/Abstract"); break; case "Publisher": c.Bound(x => x.PublisherName).Title("Publisher Name"); c.Bound(x => x.PublisherCity).Title("Publisher City"); c.Bound(x => x.PublisherState).Title("Publisher State"); c.Bound(x => x.PublisherCountry).Title("Publisher Country"); break; case "Conference": c.Bound(x => x.ConferenceName).Title("Conference Name"); c.Bound(x => x.ConferenceLocation).Title("Conference Location"); c.Bound(x => x.ConferenceBeginDate).Title("Conference Start Date"); c.Bound(x => x.ConferenceEndDate).Title("Conference End Date"); break; case "Journal": c.Bound(x => x.JournalTypeDisplayName).Title("Journal Type"); c.Bound(x => x.JournalName).Title("Journal Name"); c.Bound(x => x.JournalVolume).Title("Journal Volume"); c.Bound(x => x.JournalIssue).Title("Journal Issue"); c.Bound(x => x.JournalSerial).Title("Journal Serial"); c.Bound(x => x.JournalStartPage).Title("Journal Beginning Page"); c.Bound(x => x.JournalEndPage).Title("Journal Ending Page"); c.Bound(x => x.JournalDoi).Title("Journal DOI"); break; case "Patent": c.Bound(x => x.PatentAssignee).Title("Patent Assignee"); break; case "OpenNet": c.Bound(x => x.OpenNetData.AccessNumber).Title("OpenNet Accession Number"); c.Bound(x => x.OpenNetData.DocLocation).Title("OpenNet Document Location"); c.Bound(x => x.OpenNetData.FieldOfficeAym).Title("OpenNet Applicable Field Office Acronym"); c.Bound(x => x.OpenNetData.DeclassStatusEnumDisplayName).Title("OpenNet Declassification Status"); c.Bound(x => x.OpenNetData.DeclassificationDate).Title("OpenNet Declassificaton Date"); c.Bound(x => x.OpenNetData.Keywords).Title("OpenNet Document Keywords"); break; case "ProtectedData": c.Bound(x => x.ProtectedData.Crada).Title("Protected Data CRADA"); c.Bound(x => x.ProtectedData.ReleaseDate).Title("Protected Access Limitation Release Date"); c.Bound(x => x.ProtectedData.ExemptNumber).Title("Protected Exemption Number"); c.Bound(x => x.ProtectedData.Description).Title("Protected Description"); break; case "OfficialUseOnly": c.Bound(x => x.AccessReleaseDate).Title("Official Use Access Limitation Release Date"); c.Bound(x => x.ExemptionNumber).Title("Official Use Exemption Number"); break; } } }); int currentColumn = 1; int currentRow = Sorts.Count + 3; // Setup all output text before exporting if (ColSelection.Contains("Contacts") && !SheetSelection.Contains("Contacts")) { sortFile.SetValue(currentColumn, currentRow, "Contacts"); currentColumn += ContactRowCount; } if (ColSelection.Contains("Authors") && !SheetSelection.Contains("Authors")) { sortFile.SetValue(currentColumn, currentRow, "Authors"); currentColumn += AuthorRowCount; } if (ColSelection.Contains("Funding") && !SheetSelection.Contains("Funding")) { sortFile.SetValue(currentColumn, currentRow, "Funding"); currentColumn += FundingRowCount; } if (ColSelection.Contains("SubjectCategories") && !SheetSelection.Contains("SubjectCategories")) { sortFile.SetValue(currentColumn, currentRow, "Subjects"); currentColumn += MetaDataRowCount; } if (ColSelection.Contains("SponsoringOrgs") && !SheetSelection.Contains("SponsoringOrgs")) { sortFile.SetValue(currentColumn, currentRow, "Sponsoring Orgs"); currentColumn += MetaDataRowCount; } if (ColSelection.Contains("Keywords") && !SheetSelection.Contains("Keywords")) { sortFile.SetValue(currentColumn, currentRow, "Keywords"); currentColumn += MetaDataRowCount; } if (ColSelection.Contains("Reviewers") && !SheetSelection.Contains("Reviewers")) { sortFile.SetValue(currentColumn, currentRow, "Reviewers"); currentColumn += ReviewersRowCount; } // Export for a template byte[] excelFile = sortFile.Export(); // Setup columns for data additions currentColumn = 1; currentRow++; // Add in all extra information if (ColSelection.Contains("Contacts")) { excelFile = GenerateContactsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Authors")) { excelFile = GenerateAuthorsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Funding")) { excelFile = GenerateFundingExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("SubjectCategories")) { excelFile = GenerateSubjectCategoryExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("SponsoringOrgs")) { excelFile = GenerateSponsoringOrgsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Keywords")) { excelFile = GenerateKeywordsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Reviewers")) { excelFile = GenerateReviewersExcel(excelFile, currentRow, ref currentColumn); } return(excelFile); }
public List <BaseItem> GetAllItemsInNpcBag(byte bag, int npcId) { DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_BAGID_PARAMETER, bag); bagIdParameter.DbType = DbType.Byte; DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_NPCID_PARAMETER, npcId); characterIdParameter.DbType = DbType.Int32; List <BaseItem> items = new List <BaseItem>(); _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLNPCITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT); int ordinalITEM_PRICE = reader.GetOrdinal(DbNames.ITEM_PRICE); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_DURABILITY = reader.GetOrdinal(DbNames.ITEM_DURABILITY); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_MAXIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG); int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { BaseItem b = null; int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if (BKind == (byte)bKindWeapons.Hammer && BType == (byte)bType.Weapon) { b = new Hammer(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.Durability = reader.GetInt32(ordinalITEM_DURABILITY); e.MaxDurability = e.Durability; e.Damage = reader.GetInt16(ordinalITEM_DAMAGE); e.Defence = reader.GetInt16(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUETRIES); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = reader.GetByte(ordinalITEM_BAG); b.Slot = reader.GetByte(ordinalITEM_SLOT); b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = reader.GetInt16(ordinalITEM_AMOUNT); b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_PRICE); items.Add(b); } reader.Close(); _db.Close(); return(items); }
public TalonViewModel(Talon talon = null) { TalonObject = talon ?? new Talon(); }
public List<BaseItem> GetAllItemsInBag(byte bag, int characterId) { DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_BAGID_PARAMETER, bag); bagIdParameter.DbType = DbType.Byte; DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_CHARACTERID_PARAMETER, characterId); characterIdParameter.DbType = DbType.Int32; List<BaseItem> items = new List<BaseItem>(); _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter); int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID); int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA); int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS); int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL); int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES); int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES); int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE); int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES); int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE); int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE); int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING); int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE); int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF); int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER); int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE); int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_IMBUEDATA = reader.GetOrdinal(DbNames.ITEM_IMBUEDATA); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES); int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1); int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2); int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3); int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4); int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1); int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2); int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3); int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4); int ordinalITEM_PETID = reader.GetOrdinal(DbNames.ITEM_PETID); int ordinalITEM_DAMAGEABSORB = reader.GetOrdinal(DbNames.ITEM_DAMAGEABSORB); int ordinalITEM_DEFENSEABSORB = reader.GetOrdinal(DbNames.ITEM_DEFENSEABSORB); int ordinalITEM_ATTACKRATINGABSORB = reader.GetOrdinal(DbNames.ITEM_ATTACKRATINGABSORB); int ordinalITEM_LIFEABSORB = reader.GetOrdinal(DbNames.ITEM_LIFEABSORB); int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG); int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { BaseItem b = null; int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape || BType == (byte)bType.Mirror) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES); c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1); c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1); c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2); c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2); c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3); c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3); c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4); c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4); } if (BType == (byte)bType.Mirror) { // bkind 4 = mirror, 0 = jar b = new Mirror(); Mirror m = b as Mirror; m.PetID = reader.GetInt32(ordinalITEM_PETID); m.LifeAbsorb = reader.GetInt16(ordinalITEM_LIFEABSORB); m.DamageAbsorb = reader.GetInt16(ordinalITEM_DAMAGEABSORB); m.DefenseAbsorb = reader.GetInt16(ordinalITEM_DEFENSEABSORB); m.AttackRatingAbsorb = reader.GetInt16(ordinalITEM_ATTACKRATINGABSORB); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES); e.Durability = reader.GetInt16(ordinalITEM_CURDURA); e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA); e.Damage = reader.GetInt32(ordinalITEM_DAMAGE); e.Defence = reader.GetInt32(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); e.Plus = reader.GetByte(ordinalITEM_PLUS); e.Slvl = reader.GetByte(ordinalITEM_SLVL); e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES); e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES); e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE); e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES); e.DragonDamage = reader.GetInt32(ordinalITEM_DRAGONDAMAGE); e.DragonDefence = reader.GetInt32(ordinalITEM_DRAGONDEFENCE); e.DragonAttackRating = reader.GetInt32(ordinalITEM_DRAGONATTACKRATING); e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE); e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF); e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER); e.RebirthHole = reader.GetInt16(ordinalITEM_REBIRTHHOLE); e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } if (BKind == (byte)bKindStones.RbItem) { b = new RbHoleItem(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); im.ImbueData = reader.GetByte(ordinalITEM_IMBUEDATA); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } if (BKind == (byte)bKindBooks.RebirdBook) { b = new RebirthBook(); } if (BKind == (byte)bKindBooks.FourthBook) { b = new FourthBook(); } if (BKind == (byte)bKindBooks.FeSkillBook) { b = new FeSkillBook(); } if (BKind == (byte)bKindBooks.FeBook) { b = new FiveElementBook(); } if (BKind == (byte)bKindBooks.FocusBook) { b = new FocusBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } if (BType == (byte)bType.StoreTag) { b = new StoreTag(); StoreTag tag = b as StoreTag; tag.TimeLeft = reader.GetInt16(ordinalITEM_CURDURA); tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA); } if (BType == (byte)bType.PetItem) { if (BKind == (byte)bKindPetItems.Taming) b = new TameItem(); if (BKind == (byte)bKindPetItems.Food) b = new PetFood(); if (BKind == (byte)bKindPetItems.Potion) b = new PetPotion(); if (BKind == (byte)bKindPetItems.Resurect) b = new PetResurrectItem(); PetItem p = b as PetItem; p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE); p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE); p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); } if (BType == (byte)bType.Pill) { if (BKind == (byte)bKindPills.Rebirth) b = new RebirthPill(); RebirthPill p = b as RebirthPill; p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS); p.ToRebirth = (byte)(p.RequiredRebirth + 1); p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX); } b.ItemID = reader.GetInt32(ordinalITEM_ITEMID); b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID); b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = reader.GetByte(ordinalITEM_BAG); b.Slot = reader.GetByte(ordinalITEM_SLOT); b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = reader.GetInt16(ordinalITEM_AMOUNT); b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_COST); items.Add(b); } reader.Close(); _db.Close(); return items; }
public byte[] GenerateExcelFile() { // Create main export with requested fields. var mainSheet = Talon.Excel(Mains).Name(DefaultSheetName).Sheet(DefaultSheetName).Columns(c => { c.Bound(x => x.StiNumber).Title("STI Number"); c.Bound(x => x.Revision).Title("Revision"); foreach (var column in ColSelection) { switch (column) { case "Title": c.Bound(x => x.Title).Title("Title"); break; case "Status": c.Bound(x => x.StatusDisplayName).Title("Status"); break; case "NumberPages": c.Bound(x => x.NumberPagesStr).Title("Number Pages"); break; case "ProductType": c.Bound(x => x.DocumentTypeStr).Title("Product Type"); break; case "CreationDate": c.Bound(x => x.CreateDateStr).Title("Creation Date"); break; case "ApprovedDate": c.Bound(x => x.ApprovalDateStr).Title("Approved Date"); break; case "Abstract": c.Bound(x => x.AbstractWithAccessCheck).Title("Abstract"); break; case "Conference": c.Bound(x => x.ConferenceName).Title("Conference Name"); c.Bound(x => x.ConferenceSponsor).Title("Conference Sponsor"); c.Bound(x => x.ConferenceLocation).Title("Conference Location"); c.Bound(x => x.ConferenceBeginDateStr).Title("Conference Start Date"); c.Bound(x => x.ConferenceEndDateStr).Title("Conference End Date"); break; case "Journal": c.Bound(x => x.JournalName).Title("Journal Name"); break; } } }); int currentColumn = 1; int currentRow = Mains.Count + 3; // Setup all output text before exporting if (ColSelection.Contains("Contacts") && !SheetSelection.Contains("Contacts")) { mainSheet.SetValue(currentColumn, currentRow, "Contacts"); currentColumn += ContactRowCount; } if (ColSelection.Contains("Authors") && !SheetSelection.Contains("Authors")) { mainSheet.SetValue(currentColumn, currentRow, "Authors"); currentColumn += AuthorRowCount; } if (ColSelection.Contains("Funding") && !SheetSelection.Contains("Funding")) { mainSheet.SetValue(currentColumn, currentRow, "Funding"); currentColumn += FundingRowCount; } if (ColSelection.Contains("Subjects") && !SheetSelection.Contains("Subjects")) { mainSheet.SetValue(currentColumn, currentRow, "Subjects"); currentColumn += MetaDataRowCount; } if (ColSelection.Contains("Intellectual") && !SheetSelection.Contains("Intellectual")) { mainSheet.SetValue(currentColumn, currentRow, "Intellectual Property"); currentColumn += IntellectualProprtyRowCount; } if (ColSelection.Contains("Keywords") && !SheetSelection.Contains("Keywords")) { mainSheet.SetValue(currentColumn, currentRow, "Keywords"); currentColumn += MetaDataRowCount; } if (ColSelection.Contains("Reviewers") && !SheetSelection.Contains("Reviewers")) { mainSheet.SetValue(currentColumn, currentRow, "Reviewers"); currentColumn += ReviewersRowCount; mainSheet.SetValue(currentColumn, currentRow, "Reviewer Comments"); currentColumn += ReviewerCommentsRowCount; } if (ColSelection.Contains("ReviewerHistory") && !SheetSelection.Contains("ReviewerHistory")) { mainSheet.SetValue(currentColumn, currentRow, "Reviewer History"); currentColumn += ReviewerHistoryRowCount; mainSheet.SetValue(currentColumn, currentRow, "Reviewer Comments History"); currentColumn += ReviewerHistoryRowCount; } // Export for a template byte[] excelFile = mainSheet.Export(); // Setup columns for data additions currentColumn = 1; currentRow++; // Add in all extra information if (ColSelection.Contains("Contacts")) { excelFile = GenerateContactsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Authors")) { excelFile = GenerateAuthorsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Funding")) { excelFile = GenerateFundingExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Subjects")) { excelFile = GenerateSubjectExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Intellectual")) { excelFile = GenerateIntellectualPropertyExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Keywords")) { excelFile = GenerateKeywordsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("Reviewers")) { excelFile = GenerateReviewersExcel(excelFile, currentRow, ref currentColumn); excelFile = GenerateReviewerCommentsExcel(excelFile, currentRow, ref currentColumn); } if (ColSelection.Contains("ReviewerHistory")) { excelFile = GenerateReviewerHistoryExcel(excelFile, currentRow, ref currentColumn); excelFile = GenerateReviewerHistoryCommentsExcel(excelFile, currentRow, ref currentColumn); } return(excelFile); }
public static GridRowTalons Create(Talon talon, int index) => new GridRowTalons(index, talon);
public Indexers() { Left = new Talon(Config.IndexMotorL); Right = new Talon(Config.IndexMotorR); ShooterBallSensor = new DigitalInput(Config.IndexerBeamBreak); }
public BaseItem GetItemByItemID(int itemID) { DbParameter itemIdParameter = _db.CreateParameter(DbNames.GETITEMBYITEMID_ITEMID_PARAMETER, itemID); itemIdParameter.DbType = DbType.Int32; BaseItem b = null; _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETITEMBYITEMID_STOREDPROC, CommandType.StoredProcedure, itemIdParameter); int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID); int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA); int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS); int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL); int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES); int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES); int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE); int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES); int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE); int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE); int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING); int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE); int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF); int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER); int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE); int ordinalITEM_REBIRTHHOLEITEM = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLEITEM); int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES); int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1); int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2); int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3); int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4); int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1); int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2); int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3); int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4); int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG); int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES); c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1); c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1); c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2); c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2); c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3); c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3); c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4); c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES); e.Durability = reader.GetInt16(ordinalITEM_CURDURA); e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA); e.Damage = reader.GetInt16(ordinalITEM_DAMAGE); e.Defence = reader.GetInt16(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); e.Plus = reader.GetByte(ordinalITEM_PLUS); e.Slvl = reader.GetByte(ordinalITEM_SLVL); e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES); e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES); e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE); e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES); e.DragonDamage = reader.GetInt16(ordinalITEM_DRAGONDAMAGE); e.DragonDefence = reader.GetInt16(ordinalITEM_DRAGONDEFENCE); e.DragonAttackRating = reader.GetInt16(ordinalITEM_DRAGONATTACKRATING); e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE); e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF); e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER); e.RebirthHole = reader.GetByte(ordinalITEM_REBIRTHHOLE); e.RebirthHoleItem = reader.GetByte(ordinalITEM_REBIRTHHOLEITEM); e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } b.ItemID = reader.GetInt32(ordinalITEM_ITEMID); b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID); b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = reader.GetByte(ordinalITEM_BAG); b.Slot = reader.GetByte(ordinalITEM_SLOT); b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = reader.GetInt16(ordinalITEM_AMOUNT); b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_COST); } reader.Close(); _db.Close(); return b; }
public BaseItem GetRebirthPillDrop(Monster m) { DbParameter levelParameter = _db.CreateParameter(DbNames.GETPILLDROPITEM_LEVEL_PARAMETER, m.Level); levelParameter.DbType = DbType.Int32; List<BaseItem> items = new List<BaseItem>(); _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETPILLDROPITEM_STOREDPROC, CommandType.StoredProcedure, levelParameter); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.DROPITEM_DURABILITY); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { BaseItem b = null; int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES); e.Durability = reader.GetInt32(ordinalITEM_MAXDURA); e.MaxDurability = reader.GetInt32(ordinalITEM_MAXDURA); e.Damage = reader.GetInt32(ordinalITEM_DAMAGE); e.Defence = reader.GetInt32(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } if (BKind == (byte)bKindStones.RbItem) { b = new RbHoleItem(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } if (BKind == (byte)bKindBooks.RebirdBook) { b = new RebirthBook(); } if (BKind == (byte)bKindBooks.FourthBook) { b = new FourthBook(); } if (BKind == (byte)bKindBooks.FeSkillBook) { b = new FeSkillBook(); } if (BKind == (byte)bKindBooks.FeBook) { b = new FiveElementBook(); } if (BKind == (byte)bKindBooks.FocusBook) { b = new FocusBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } if (BType == (byte)bType.StoreTag) { b = new StoreTag(); StoreTag tag = b as StoreTag; tag.TimeLeft = reader.GetInt16(ordinalITEM_MAXDURA); tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA); } if (BType == (byte)bType.PetItem) { if (BKind == (byte)bKindPetItems.Taming) b = new TameItem(); if (BKind == (byte)bKindPetItems.Food) b = new PetFood(); if (BKind == (byte)bKindPetItems.Potion) b = new PetPotion(); if (BKind == (byte)bKindPetItems.Resurect) b = new PetResurrectItem(); PetItem p = b as PetItem; p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE); p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE); p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); } if (BType == (byte)bType.Pill) { if (BKind == (byte)bKindPills.Rebirth) b = new RebirthPill(); RebirthPill p = b as RebirthPill; p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS); p.ToRebirth = (byte)(p.RequiredRebirth + 1); p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX); } b.ItemID = 0; b.OwnerID = 0; b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = 0; b.Slot = 0; b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = 1; b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_COST); items.Add(b); } reader.Close(); _db.Close(); if (items.Count > 0) { Random rand = new Random(); int itemPos = rand.Next(0, items.Count); return items[itemPos]; } else return null; }