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 static DODInstance AddRare(DODGroup group, Item src) { // Make a copy of the rare Item StoredItem = DupeItem(src); // Log the fact that we're about to move the item into storage LogHelper lh = new LogHelper("RareTemplateCreation.log", false, true); lh.Log(LogType.Item, StoredItem); lh.Finish(); // Store the copy away StoredItem.MoveItemToIntStorage(); // Instance the DOD on this copy DODInstance di = new DODInstance(StoredItem); // Add a new DOD instance based on the item passed m_DODInst.Add(di); // Add a reference to our active group group.DODInst.Add(di); return(di); }
private static Item GenerateDODObject(DODInstance dodi) { // Console.WriteLine("GenerateDODObject() : Generating object instance from {0}, rare name {1}", dodi.RareTemplate, dodi.Name); Item newitem = RareFactory.DupeItem(dodi.RareTemplate); // Make sure it's movable newitem.Movable = true; // Dynamically fill rare data if (dodi.CurIndex == 0) { dodi.CurIndex = dodi.StartIndex; } else { dodi.CurIndex++; } dodi.DynamicFill(newitem); return(newitem); }
// Expire the rare public void Expire() { // Log this deletion before we lose all the associated data :P LogHelper lh = new LogHelper("RareExpiration.log", false, true); lh.Log(LogType.Item, this.RareTemplate, string.Format("{0}", this.Name)); lh.Finish(); // Delete the "in storage" rare this.RareTemplate.Delete(); // Find it in the group lists + remove for (int i = 0; i < RareFactory.DODGroup.Count; i++) { DODGroup dg = (DODGroup)RareFactory.DODGroup[i]; for (int ir = 0; ir < dg.DODInst.Count; ir++) { if (((DODInstance)dg.DODInst[ir]) == this) { // There should never be more than one of these right? dg.DODInst.RemoveAt(ir); break; } } } // Find it in the main rare list + remove for (int i = 0; i < RareFactory.DODInst.Count; i++) { DODInstance di = (DODInstance)RareFactory.DODInst[i]; if (di == this) { // There should never be more than one of these right? RareFactory.DODInst.RemoveAt(i); break; } } }
private static Item _AcquireRare(short iRarity, string sGroupName) { try { // Make sure the RareFactory is available. Send a message back instead of a rare if it is not. ArrayList matches = new ArrayList(); if (m_Available) { // Search the DODInstance definitions // for ones matching this type of object for (int i = 0; i < m_DODGroup.Count; i++) { DODGroup dg = (DODGroup)m_DODGroup[i]; // Validate group name if (sGroupName != "") { bool match = false; // Parse the group name. If it contains commas, we need to split by comma if (sGroupName.Contains(",")) { // Multiple group names string[] gnames = sGroupName.Split(','); for (int gi = 0; gi < gnames.Length; gi++) { if (gnames[gi].ToLower() == dg.Name.ToLower()) { match = true; } } } else { // Single group name if (sGroupName.ToLower() == dg.Name.ToLower()) { match = true; } } if (match == false) { continue; // next group } } for (int di = 0; di < dg.DODInst.Count; di++) { DODInstance dinst = (DODInstance)dg.DODInst[di]; if (dinst.Valid) { if (dg.Rarity == iRarity) { if (dinst.RareTemplate == null) { try { throw new ApplicationException("AcquireRare: dinst.RareTemplate == null"); } catch (Exception ex) { LogHelper.LogException(ex); } } matches.Add(dinst); } } } } } // the boobie prize if (!m_Available || matches.Count == 0) { return(new Rocks()); } // Choose one of these types randomly // and generate the object (also dynamically // fills the object's strings) return(GenerateDODObject((DODInstance)matches[Utility.Random(matches.Count)])); } catch (Exception ex) { // failsafe LogHelper.LogException(ex); return(new Rocks()); } }
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 static DODInstance AddRare(DODGroup group, Item src) { // Make a copy of the rare Item StoredItem = DupeItem(src); // Log the fact that we're about to move the item into storage LogHelper lh = new LogHelper("RareTemplateCreation.log", false, true); lh.Log(LogType.Item, StoredItem); lh.Finish(); // Store the copy away StoredItem.MoveItemToIntStorage(); // Instance the DOD on this copy DODInstance di = new DODInstance(StoredItem); // Add a new DOD instance based on the item passed m_DODInst.Add(di); // Add a reference to our active group group.DODInst.Add(di); return di; }
private static Item GenerateDODObject( DODInstance dodi ) { // Console.WriteLine("GenerateDODObject() : Generating object instance from {0}, rare name {1}", dodi.RareTemplate, dodi.Name); Item newitem = RareFactory.DupeItem(dodi.RareTemplate); // Make sure it's movable newitem.Movable = true; // Dynamically fill rare data if( dodi.CurIndex == 0 ) dodi.CurIndex = dodi.StartIndex; else dodi.CurIndex++; dodi.DynamicFill(newitem); return newitem; }