private static void Write_Char_Pending_Trades(Character _myChar, StreamWriter w, List <Itemz> _items) { if (_myChar._Trade_List != null) { int iterations = _myChar._Trade_List.Count() / 8; w.WriteLine("<p>Pending Trades:</p>"); w.WriteLine("<table>"); w.WriteLine("<tr><td style=\"text-align:right\">trade</td><td style=\"text-align:right\">price</td><td style=\"text-align:right\">qty</td><td style=\"text-align:left\">item</td></tr>"); w.WriteLine("<tr><td style=\"text-align:right\">---</td><td style=\"text-align:right\">----</td><td style=\"text-align:left\">-----</td></tr>"); for (int i = 0; i < iterations; i++) { int _type = _myChar._Trade_List[(i * 8)]; int _item = _myChar._Trade_List[(i * 8) + 1]; int _qty = Convert.ToInt32(_myChar._Trade_List[(i * 8) + 2]); int _cost = Convert.ToInt32(_myChar._Trade_List[(i * 8) + 3]); w.WriteLine("<tr>"); Itemz _myitem = _items.Find(x => x._ItemId == Convert.ToInt32(_item)); if (_myitem != null) { w.WriteLine("<td style=\"text-align:right\">" + (_type == 1 ? "buy" : "sell") + "</td>"); w.WriteLine("<td style=\"text-align:right\">" + _cost + "</td>"); w.WriteLine("<td style=\"text-align:right\">" + _qty + "</td>"); w.WriteLine("<td style=\"text-align:left\">" + (_qty == 1 ? _myitem._Name : _myitem._Plural) + " [" + Utilities.To_Oid(_item.ToString()) + "]</td>"); } w.WriteLine("</tr>"); } w.WriteLine("</table>"); } }
public static Weight Determine_Unit_Weights(Character _myChar, List <Itemz> _items) { Weight myweight = new Weight() { _animals = 0, _total_weight = 0, _land_cap = 0, _land_weight = 0, _ride_cap = 0, _ride_weight = 0, _fly_cap = 0, _fly_weight = 0 }; if (_myChar._Item_List != null) { int unit_type = (_myChar._CH_NPC_Unit_Type != 0 ? _myChar._CH_NPC_Unit_Type : 10); Itemz myitem = _items.Find(x => x._ItemId == unit_type); myweight = Itemz.Add_Item_Weight(myitem, 1, myweight); myitem = null; int iterations = _myChar._Item_List.Count / 2; for (int i = 0; i < iterations; i++) { if (_items.Find(x => x._ItemId == _myChar._Item_List[i * 2]) != null) { myitem = _items.Find(x => x._ItemId == _myChar._Item_List[i * 2]); myweight = Itemz.Add_Item_Weight(myitem, (_myChar._Item_List[(i * 2) + 1]), myweight); } } } return(myweight); }
public static Weight Add_Item_Weight(Itemz myitem, int qty, Weight myweight) { int item_weight = myitem._Weight * qty; if (myitem._Land_Capacity > 0) { myweight._land_cap += myitem._Land_Capacity * qty; } else { myweight._land_weight += item_weight; } if (myitem._Ride_Capacity > 0) { myweight._ride_cap += myitem._Ride_Capacity * qty; } else { myweight._ride_weight += item_weight; } if (myitem._Fly_Capacity > 0) { myweight._fly_cap += myitem._Fly_Capacity * qty; } else { myweight._fly_weight += item_weight; } myweight._total_weight += item_weight; if (myitem._IT_Animal == 1) { myweight._animals += qty; } return(myweight); }
public static bool Is_Fighter(Itemz myitem) { if (myitem._IT_Attack > 0 || myitem._IT_Defense > 0 || myitem._IT_Missile > 0 || myitem._ItemId == 18) { return(true); } return(false); }
public static void Generate_Item_List_HTML(string path, List <Character> _characters, List <Itemz> _items, List <Location> _locations, List <Ship> _ships, List <Skill> _skills) { using (FileStream fs = new FileStream(System.IO.Path.Combine(path, "master_item_list.html"), FileMode.Create)) { using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8)) { w.WriteLine("<HTML>"); w.WriteLine("<HEAD>"); w.WriteLine("<TITLE>Olympia Master Item List</TITLE>"); w.WriteLine("</HEAD>"); w.WriteLine("<BODY>"); w.WriteLine("<h3>Olympia Master Item List</h3>"); w.WriteLine("<table border=\"1\" style=\"border-collapse: collapse\">"); w.WriteLine("<tr>"); w.WriteLine("<th>Item</th><th>Item Type</th><th>Weight</th><th>Man Item</th><th>Prominent</th><th>Animal</th><th>Land Cap</th><th>Riding cap</th><th>Flying Cap</th><th>Who Has</th><th>Notes</th>"); w.WriteLine("</tr>"); foreach (Itemz _item in _items) { w.WriteLine("<tr>"); w.WriteLine("<td>" + _item._Name + " [" + _item._ItemId_Conv + "]</td>"); w.WriteLine("<td>" + (_item._Item_Type != "0" ? _item._Item_Type : "std item") + "</td>"); w.WriteLine("<td>" + _item._Weight + "</td>"); w.WriteLine("<td>" + (_item._IT_Man_Item == 1 ? "yes" : "") + "</td>"); w.WriteLine("<td>" + (_item._IT_Prominent == 1 ? "yes" : "") + "</td>"); w.WriteLine("<td>" + (_item._IT_Animal == 1 ? "yes" : "") + "</td>"); w.WriteLine("<td>" + _item._Land_Capacity + "</td>"); w.WriteLine("<td>" + _item._Ride_Capacity + "</td>"); w.WriteLine("<td>" + _item._Fly_Capacity + "</td>"); if (_item._IT_Who_Has != 0) { if (_characters.Find(x => x._CharId == _item._IT_Who_Has) != null) { Character _mychar = _characters.Find(x => x._CharId == _item._IT_Who_Has); w.WriteLine("<td>" + _mychar._Name + " " + Utilities.Format_Anchor(_mychar._CharId.ToString()) + "</td>"); } else { w.WriteLine("<td> </td>"); } } else { w.WriteLine("<td> </td>"); } w.WriteLine("<td>" + Itemz.Determine_Use(_item, _characters, _locations, _ships, _skills) + " </td>"); w.WriteLine("</tr>"); } w.WriteLine("</table>"); w.WriteLine("</BODY>"); w.WriteLine("</HTML>"); } fs.Dispose(); } }
public static Boolean ReallyHidden(Character mychar, List <Character> _characters, List <Itemz> _items, List <Location> _locations, List <Ship> _ships) { if (mychar._CM_Hide_Self == 1) { if (mychar._Item_List != null) { int iterations = mychar._Item_List.Count / 2; for (int i = 0; i < iterations; i++) { if (_items.Find(x => x._ItemId == mychar._Item_List[i * 2]) != null) { Itemz myitem = _items.Find(x => x._ItemId == mychar._Item_List[i * 2]); if (Itemz.Is_Fighter(myitem) || myitem._IT_Man_Item == 1) { return(false); } } } } if (mychar._LI_Here_List != null) { return(false); } if (_characters.Find(x => x._CharId == mychar._LI_Where) != null) { return(false); } if (_ships.Find(x => x._ShipId == mychar._LI_Where) != null) { if (_ships.Find(x => x._ShipId == mychar._LI_Where)._LI_Here_List[0] == mychar._CharId) { return(false); } } if (_locations.Find(x => x._LocId == mychar._LI_Where) != null) { if (_locations.Find(x => x._LocId == mychar._LI_Where)._SL_Defense > 0) { if (_locations.Find(x => x._LocId == mychar._LI_Where)._LI_Here_List[0] == mychar._CharId) { return(false); } } } return(true); } return(false); }
private static void Write_Magic_Stuff(Character _MyChar, StreamWriter w, List <Itemz> _items, List <Skill> _skills, List <Location> _locations, List <Ship> _ships) { StringBuilder outline = new StringBuilder(); if (_MyChar._Item_List != null) { int iterations = _MyChar._Item_List.Count() / 2; for (int i = 0; i < iterations; i++) { int _item = _MyChar._Item_List[(i * 2)]; Itemz _myitem = _items.Find(x => x._ItemId == _item); if (_myitem != null) { if (_myitem._Item_Type == "0") { if (_myitem._IM_Use_Key == 2) { // healing potion outline.Clear(); outline.Append("<p>"); outline.Append("Healing Potion "); outline.Append(Utilities.Format_Anchor(_myitem._ItemId_Conv)); outline.Append("</p>"); w.WriteLine(outline); } else { if (_myitem._IM_Use_Key == 5) { // potion outline.Clear(); outline.Append("<p>"); outline.Append("Projected Cast "); outline.Append(Utilities.Format_Anchor(_myitem._ItemId_Conv)); outline.Append(" to "); if (_myitem._IM_Project_Cast != 0) { Location _myloc = _locations.Find(x => x._LocId == _myitem._IM_Project_Cast); if (_myloc != null) { outline.Append("location " + _myloc._Name + " " + Utilities.Format_Anchor(_myloc._LocId_Conv)); } else { Ship _myship = _ships.Find(x => x._ShipId == _myitem._IM_Project_Cast); if (_myship != null) { outline.Append("ship " + _myship._Name + " " + Utilities.Format_Anchor(_myship._ShipId.ToString())); } else { outline.Append("target [" + _myitem._IM_Project_Cast + "] no longer exists"); } } } outline.Append("</p>"); w.WriteLine(outline); } } } else { if (_myitem._Item_Type == "scroll") { // scroll //Scroll[p294] permits study of the following skills: // Hinder meditation[814] (requires Magic) Skill _myskill = _skills.Find(x => x._SkillId == _myitem._IM_May_Study); outline.Clear(); outline.Append("<p>"); outline.Append("Scroll "); outline.Append(Utilities.Format_Anchor(_myitem._ItemId_Conv)); outline.Append(" permits the study of the following skills:<br>"); outline.Append(" "); if (_myskill == null) { outline.Append("???"); } else { outline.Append(_myskill._Name + " "); outline.Append(Utilities.Format_Anchor(_myskill._SkillId.ToString())); if (_myskill._SK_Required_Skill != 0) { Skill _myskill_req = _skills.Find(x => x._SkillId == _myskill._SK_Required_Skill); outline.Append(" (requires "); outline.Append(_myskill_req._Name); outline.Append(")"); } } outline.Append("</p>"); w.WriteLine(outline); } } } } } }
private static void Write_Char_Inventory(Character _myChar, StreamWriter w, List <Itemz> _items) { int total_weight = 0; if (_myChar._Item_List != null) { int iterations = _myChar._Item_List.Count() / 2; w.WriteLine("Inventory:"); w.WriteLine("<table>"); w.WriteLine("<tr><td style=\"text-align:right\">qty</td><td style=\"text-align:left\">name</td><td style=\"text-align:right\">weight</td><td style=\"text-align:left\"> </td></tr>"); w.WriteLine("<tr><td style=\"text-align:right\">---</td><td style=\"text-align:left\">----</td><td style=\"text-align:right\">-----</td></tr>"); for (int i = 0; i < iterations; i++) { int _item = _myChar._Item_List[(i * 2)]; int _qty = _myChar._Item_List[(i * 2) + 1]; w.WriteLine("<tr>"); w.WriteLine("<td style=\"text-align:right\">" + _qty.ToString("N0") + "</td>"); Itemz _myitem = _items.Find(x => x._ItemId == _item); if (_myitem != null) { w.WriteLine("<td style=\"text-align:left\">" + (_qty == 1 ? _myitem._Name : _myitem._Plural) + " [" + Utilities.To_Oid(_item.ToString()) + "]</td>"); w.WriteLine("<td style=\"text-align:right\">" + (_myitem._Weight * _qty).ToString("N0") + "</td>"); total_weight += (_myitem._Weight * _qty); StringBuilder outline = new StringBuilder(); outline.Append("<td>"); if (_myChar._Char_Type.ToUpper() != "GARRISON") { if (_myitem._Fly_Capacity > 0) { outline.Append("fly " + (_myitem._Fly_Capacity * _qty).ToString("N0")); } else { if (_myitem._Ride_Capacity > 0) { outline.Append("ride " + (_myitem._Ride_Capacity * _qty).ToString("N0")); } else { if (_myitem._Land_Capacity > 0) { outline.Append("cap " + (_myitem._Land_Capacity * _qty).ToString("N0")); } } } if (Itemz.Is_Fighter(_myitem)) { outline.AppendFormat(" ({0},{1},{2})", _myitem._IT_Attack, _myitem._IT_Defense, _myitem._IT_Missile); } outline.Append(_myitem._IM_Attack_Bonus > 0 ? ("+" + _myitem._IM_Attack_Bonus + " attack") : ""); outline.Append(_myitem._IM_Defense_Bonus > 0 ? ("+" + _myitem._IM_Defense_Bonus + " defense") : ""); outline.Append(_myitem._IM_Missile_Bonus > 0 ? ("+" + _myitem._IM_Missile_Bonus + " missile") : ""); if (Character.Is_Magician(_myChar) && _myitem._IM_Aura_Bonus > 0) { outline.AppendFormat("+{0} aura)", _myitem._IM_Aura_Bonus); } outline.Append(" </td>"); w.WriteLine(outline); } else { w.WriteLine("<td>" + "undefined" + "</td>"); w.WriteLine("<td>" + 0 + "</td>"); w.WriteLine("<td> </td>"); } w.WriteLine("</tr>"); } } if (_myChar._Char_Type.ToUpper() != "GARRISON") { w.WriteLine("<tr><td></td><td></td><td style=\"text-align:right\">=====</td><td> </td></tr>"); w.WriteLine("<tr><td></td><td></td><td style=\"text-align:right\">" + total_weight.ToString("N0") + "</td><td> </td></tr>"); } w.WriteLine("</table>"); } else { w.WriteLine("<p>" + _myChar._Name + " [" + _myChar._CharId + "] has no possessions.</p>"); } }
public static string Determine_Use(Itemz _myitem, List <Character> _characters, List <Location> _locations, List <Ship> _ships, List <Skill> _skills) { //if (_myitem._Item_Type.Equals("0")) //{ // return ""; //} if (_myitem._Item_Type.Equals("0")) { if (_myitem._IM_Use_Key != 0) { if (_myitem._IM_Use_Key.Equals(1)) { return("death potion"); } if (_myitem._IM_Use_Key.Equals(2)) { return("healing potion"); } if (_myitem._IM_Use_Key.Equals(3)) { return("slave potion"); } if (_myitem._IM_Use_Key.Equals(4)) { return("palantir"); } if (_myitem._IM_Use_Key.Equals(5)) { StringBuilder outline = new StringBuilder(); outline.Append("projected cast potion"); if (_myitem._IM_Project_Cast != 0) { Location _myloc = _locations.Find(x => x._LocId == _myitem._IM_Project_Cast); if (_myloc != null) { outline.Append(", " + _myloc._Name + " " + Utilities.Format_Anchor(_myloc._LocId_Conv)); } else { Ship _myship = _ships.Find(x => x._ShipId == _myitem._IM_Project_Cast); if (_myship != null) { outline.Append(", " + _myship._Name + " " + Utilities.Format_Anchor(_myship._ShipId.ToString())); } else { outline.Append(", target [" + _myitem._IM_Project_Cast + "] no longer exists"); } } } return(outline.ToString()); } if (_myitem._IM_Use_Key.Equals(6)) { return("quick cast potion"); } if (_myitem._IM_Use_Key.Equals(7)) { // drum, nothing for now return(""); } if (_myitem._IM_Use_Key.Equals(8)) { return("elf stone"); } if (_myitem._IM_Use_Key.Equals(9)) { return("orb"); } return("undefined use: " + _myitem._IM_Use_Key); } else { return(""); } } if (_myitem._Item_Type.Equals("artifact")) { StringBuilder outline = new StringBuilder(); if (_myitem._IM_Attack_Bonus != 0) { if (outline.Length > 0) { outline.Append(", "); } outline.Append("attack +" + _myitem._IM_Attack_Bonus); } if (_myitem._IM_Defense_Bonus != 0) { if (outline.Length > 0) { outline.Append(", "); } outline.Append("defense +" + _myitem._IM_Defense_Bonus); } if (_myitem._IM_Missile_Bonus != 0) { if (outline.Length > 0) { outline.Append(", "); } outline.Append("missile +" + _myitem._IM_Missile_Bonus); } if (_myitem._IM_Aura_Bonus != 0) { if (outline.Length > 0) { outline.Append(", "); } outline.Append("aura +" + _myitem._IM_Aura_Bonus); } return(outline.ToString()); } if (_myitem._Item_Type.Equals("dead body")) { Character _mychar = _characters.Find(x => x._CharId == _myitem._PL_Unit); if (_mychar != null) { return("Formerly known as: " + _mychar._Name + " [" + Utilities.Format_Anchor(_mychar._CharId.ToString()) + "]"); } else { return("dead, deader, deadest"); } } if (_myitem._Item_Type.Equals("npc_token")) { if (_myitem._PL_Unit != 0) { Character _mychar = _characters.Find(x => x._CharId == _myitem._PL_Unit); if (_mychar != null) { return("Controls: " + _mychar._Name + " " + Utilities.Format_Anchor(_mychar._CharId.ToString())); } else { return("undefined"); } } else { return("undefined"); } } if (_myitem._Item_Type.Equals("auraculum")) { return("aura: " + _myitem._IM_Aura); } if (_myitem._Item_Type.Equals("scroll")) { Skill _myskill = _skills.Find(x => x._SkillId == _myitem._IM_May_Study); if (_myskill != null) { return("study: " + _myskill._Name + " [" + _myitem._IM_May_Study + "]"); } else { return(""); } } if (_myitem._Item_Type.Equals("tradegood")) { StringBuilder outline = new StringBuilder(); List <Location> _myloc = _locations.FindAll(x => x._Trade_List != null); if (_myloc != null) { foreach (Location _myloctrade in _myloc) { int iterations = _myloctrade._Trade_List.Count / 8; for (int i = 0; i < iterations; i++) { if ((_myloctrade._Trade_List[(i * 8) + 1]) == _myitem._ItemId) { if (_myloctrade._Trade_List[(i * 8) + 0] == 1 || _myloctrade._Trade_List[(i * 8) + 0] == 2) { if (_myloctrade._Trade_List[(i * 8) + 0] == 1) { if (outline.Length > 0) { outline.Append(", "); } outline.Append("buy: " + _myloctrade._Name + " " + Utilities.Format_Anchor(_myloctrade._LocId_Conv)); } if (_myloctrade._Trade_List[(i * 8) + 0] == 2) { if (outline.Length > 0) { outline.Append(", "); } outline.Append("sell: " + _myloctrade._Name + " " + Utilities.Format_Anchor(_myloctrade._LocId_Conv)); } } } } } if (outline.Length > 0) { return(outline.ToString()); } else { return("inactive"); } } else { return(""); } } return(""); }
public static void Generate_Projected_Cast_Potion_List_HTML(string path, List <Character> _characters, List <Itemz> _items, List <Location> _locations, List <Ship> _ships, List <Skill> _skills) { using (FileStream fs = new FileStream(System.IO.Path.Combine(path, "master_projected_cast_potion_list.html"), FileMode.Create)) { using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8)) { w.WriteLine("<HTML>"); w.WriteLine("<HEAD>"); w.WriteLine("<TITLE>Olympia Master Projected Cast Potion List</TITLE>"); w.WriteLine("</HEAD>"); w.WriteLine("<BODY>"); w.WriteLine("<h3>Olympia Master Projected Cast Potion List</h3>"); w.WriteLine("<table border=\"1\" style=\"border-collapse: collapse\">"); w.WriteLine("<tr>"); w.WriteLine("<th>Item</th><th>Who Has</th><th>Location</th><th>Notes</th>"); w.WriteLine("</tr>"); foreach (Itemz _item in _items.Where(t => t._Item_Type == "0").Where(u => u._IM_Use_Key.Equals(5))) { w.WriteLine("<tr>"); w.WriteLine("<td>" + _item._Name + " [" + _item._ItemId_Conv + "]</td>"); if (_item._IT_Who_Has != 0) { if (_characters.Find(x => x._CharId == _item._IT_Who_Has) != null) { Character _mychar = _characters.Find(x => x._CharId == _item._IT_Who_Has); w.WriteLine("<td>" + _mychar._Name + " " + Utilities.Format_Anchor(_mychar._CharId.ToString()) + "</td>"); w.WriteLine("<td>" + _mychar.Calc_CurrentLoc + " in " + _locations.Find(g => g._LocId == _mychar.Calc_CurrentRegion)._Name + " </td>"); } else { if (_locations.Find(x => x._LocId == _item._IT_Who_Has) != null) { Location _myloc = _locations.Find(x => x._LocId == _item._IT_Who_Has); w.WriteLine("<td>" + _myloc._Name + " " + Utilities.Format_Anchor(_myloc._LocId.ToString()) + "</td>"); w.WriteLine("<td>" + _myloc.Calc_CurrentLoc + " in " + _locations.Find(g => g._LocId == _myloc.Calc_CurrentRegion)._Name + " </td>"); } else { w.WriteLine("<td> </td>"); w.WriteLine("<td> </td>"); } } } else { w.WriteLine("<td> </td>"); w.WriteLine("<td> </td>"); } w.WriteLine("<td>" + Itemz.Determine_Use(_item, _characters, _locations, _ships, _skills) + " </td>"); w.WriteLine("</tr>"); } w.WriteLine("</table>"); w.WriteLine("</BODY>"); w.WriteLine("</HTML>"); } fs.Dispose(); } }