private void LoadRareView(DODInstance dodi) { if (dodi == null) { AddLabel(gx + 16, gy + 50, 1152, "No Dynamic Object Definitions defined."); return; } AddItem(gx + 50, gy + 60, dodi.RareTemplate.ItemID); AddLabel(gx + 150, gy + 60, 1152, "Name "); AddLabel(gx + 240, gy + 60, 1152, ": " + dodi.Name); AddLabel(gx + 150, gy + 75, 1152, "Item ID "); AddLabel(gx + 240, gy + 75, 1152, ": " + dodi.RareTemplate.ItemID.ToString()); AddLabel(gx + 150, gy + 90, 1152, "Type "); AddLabel(gx + 240, gy + 90, 1152, ": " + dodi.RareTemplate.GetType().ToString()); AddLabel(gx + 150, gy + 105, 1152, "Serial "); AddLabel(gx + 240, gy + 105, 1152, ": " + dodi.RareTemplate.Serial.ToString()); AddLabel(gx + 150, gy + 120, 1152, "Cur Index "); AddLabel(gx + 240, gy + 120, 1152, ": " + dodi.CurIndex.ToString()); AddLabel(gx + 150, gy + 135, 1152, "Start Index "); AddLabel(gx + 240, gy + 135, 1152, ": " + dodi.StartIndex.ToString()); AddLabel(gx + 150, gy + 150, 1152, "Last Index "); AddLabel(gx + 240, gy + 150, 1152, ": " + dodi.LastIndex.ToString()); AddLabel(gx + 150, gy + 165, 1152, "Start Date "); AddLabel(gx + 240, gy + 165, 1152, ": " + dodi.StartDate.ToString()); AddLabel(gx + 150, gy + 180, 1152, "End Date "); AddLabel(gx + 240, gy + 180, 1152, ": " + dodi.EndDate.ToString()); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch ((RFButtons)info.ButtonID) { case RFButtons.AddRareButton: { // Make sure a group has been defined (if one has, one will be // selected by default - group 0) if (RareFactory.DODGroup.Count == 0) { from.SendMessage("You must define a Dynamic Object Definition Group before adding rares."); break; } from.SendMessage("Select the item you wish to use as a template for this rare..."); from.Target = new RareTarget(); break; } case RFButtons.DelRareButton: { if (RareFactory.ViewingDODGroup.DODInst.Count == 0) { from.SendMessage("There are no rares to delete!"); break; } from.SendMessage("Are you sure you wish to delete this rare? (y/n)"); from.Prompt = new DelConfirmPrompt(from); break; } case RFButtons.NextRareButton: { if (RareFactory.DODGroup.Count == 0) { from.SendMessage("No rares defined!"); break; } // The .ViewingDODIndex references the relative index // within this particular DODGroup DODGroup dg = (DODGroup)RareFactory.DODGroup[RareFactory.ViewingDODGroupIndex]; if ((RareFactory.ViewingDODIndex + 1) >= dg.DODInst.Count) { from.SendMessage("Last rare in group!"); break; } else { RareFactory.ViewingDODIndex++; break; } } case RFButtons.PrevRareButton: { if (RareFactory.DODGroup.Count == 0) { from.SendMessage("No rares defined!"); break; } // The .ViewingDODIndex references the relative index // within this particular DODGroup if (RareFactory.ViewingDODIndex == 0) { from.SendMessage("First rare in group!"); break; } else { RareFactory.ViewingDODIndex--; break; } } case RFButtons.TestButton: { if (RareFactory.DODGroup.Count == 0) { from.SendMessage("Define Dynamic Object Definition Groups and objects (rares) before attempting to generate test batches."); break; } if (((DODGroup)RareFactory.DODGroup[RareFactory.ViewingDODGroupIndex]).DODInst.Count == 0) { from.SendMessage("You must add rares to the group before attempting to generate test batches."); break; } int prevCur = RareFactory.ViewingDOD.CurIndex; // Generates a complete set of rares as a test from.SendMessage("Generating example rare set..."); for (int i = RareFactory.ViewingDOD.StartIndex; i <= RareFactory.ViewingDOD.LastIndex; i++) { // Create a new item DODInstance dodi = RareFactory.ViewingDOD; Item newitem = RareFactory.DupeItem(dodi.RareTemplate); newitem.Movable = true; dodi.CurIndex = (short)i; dodi.DynamicFill(newitem); from.AddToBackpack(newitem); } RareFactory.ViewingDOD.CurIndex = (short)prevCur; from.SendMessage("Completed. {0} rares generated and added to your backpack.", (RareFactory.ViewingDOD.LastIndex - RareFactory.ViewingDOD.StartIndex) + 1); break; } default: { return; } } RareFactory.ReloadViews(from); }
private short state; // 0 = StartDate, 1 = EndDate public DatePrompt(short st, Mobile from, DODInstance dodinst) { state = st; m_from = from; m_DODInst = dodinst; }
public RareNamePrompt(Mobile from, DODInstance dodinst) { m_from = from; m_DODInst = dodinst; }
public override void Execute(CommandEventArgs e, object obj) { try { Item item = obj as Item; if (!RareFactory.InUse) { if (e.Arguments.Length == 4) { int iRarity = 0; if (int.TryParse(e.Arguments[1], out iRarity) == true && iRarity >= 0 && iRarity <= 10) { DODGroup match; if ((match = FindGroup(e.Arguments[0], iRarity)) != null) { int iStartIndex = 0; if (int.TryParse(e.Arguments[2], out iStartIndex) == true && iStartIndex > 0 && iStartIndex <= 255) { int iLastIndex = 0; if (int.TryParse(e.Arguments[3], out iLastIndex) == true && iLastIndex > 0 && iLastIndex <= 255) { if (item != null) { LogHelper Logger = null; try { DODInstance di = RareFactory.AddRare(match, item); // rarity is defined by the group di.LastIndex = (short)iLastIndex; di.StartIndex = (short)iStartIndex; di.StartDate = DateTime.MinValue; // valid now di.EndDate = DateTime.MaxValue; // valid forever // default the name to the name of the item if (item.Name != null && item.Name != "") { di.Name = item.Name; } else { di.Name = item.GetType().Name; } AddResponse("Sucessfully defined new rare '" + di.Name + "'!"); } catch (Exception ex) { LogHelper.LogException(ex); e.Mobile.SendMessage(ex.Message); } finally { if (Logger != null) { Logger.Finish(); } } } else { LogFailure("Only an item may be converted into a rare."); } } else { LogFailure("The LastIndex must be a numeric value between 1 and 255 inclusive."); } } else { LogFailure("The StartIndex must be a numeric value between 1 and 255 inclusive."); } } else { LogFailure(String.Format("Could not find the group \"{0}\" with a rarity of {1}", e.Arguments[0], iRarity)); } } else { LogFailure("The rarity must be a numeric value between 0 and 10 inclusive."); } } else { LogFailure("AddRare sGroup iRarity iStartIndex iLastIndex"); } } else { LogFailure("Rare Factory is currently being configured by another administrator! Please wait. "); } } catch (Exception exe) { LogHelper.LogException(exe); e.Mobile.SendMessage(exe.Message); } }