public PreviewHouse( int multiID ) : base( multiID | 0x8000 ) { m_Components = new List<Item>(); MultiComponentList mcl = this.Components; for ( int i = 1; i < mcl.List.Length; ++i ) { MultiTileEntry entry = mcl.List[i]; if ( entry.m_Flags == 0 ) { #region SA Item item = new Static( entry.m_ItemID & 0x7FFF ); #endregion item.MoveToWorld( new Point3D( X + entry.m_OffsetX, Y + entry.m_OffsetY, Z + entry.m_OffsetZ ), Map ); m_Components.Add( item ); } } m_Timer = new DecayTimer( this ); m_Timer.Start(); }
public OphidianArchmage() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 ) { LastTimeSpoken = DateTime.Now; Name = m_Names[Utility.Random( m_Names.Length )]; Body = 85; SpeechHue = 2129; BaseSoundID = 639; SetStr( 281, 305 ); SetDex( 191, 215 ); SetInt( 226, 250 ); SetHits( 169, 183 ); SetStam( 36, 45 ); SetDamage( 5, 10 ); SetSkill( SkillName.EvalInt, 95.1, 120.0 ); SetSkill( SkillName.Magery, 95.1, 100.0 ); SetSkill( SkillName.MagicResist, 75.0, 97.5 ); SetSkill( SkillName.Tactics, 65.0, 87.5 ); SetSkill( SkillName.Wrestling, 20.2, 60.0 ); Fame = 11500; Karma = -11500; VirtualArmor = 44; Item item = null; switch( Utility.Random(1000) ) { case 0: PackItem( item = new Static(0x1E92) ); break; case 1: PackItem( item = new Static(0x1E93) ); break; } if (item != null) item.Movable = true; PackGold( 450, 500 ); PackScroll( 0, 8 ); PackScroll( 0, 8 ); PackScroll( 0, 8 ); switch ( Utility.Random( 2 ) ) { case 0: PackWeapon( 0, 5 ); break; case 1: PackArmor( 0, 5 ); break; } switch ( Utility.Random( 5 ) ) { case 0: PackWeapon( 1, 5 ); break; case 1: PackArmor( 1, 5 ); break; } if ( 0.10 > Utility.RandomDouble() ) PackItem( new Arrow( Utility.RandomMinMax( 150, 250 ) ) ); if ( 0.01 > Utility.RandomDouble() ) PackItem( new InvisCloak() ); }
void Awake() { if (instance != null) { Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); }
private Static save; //日数、起動回数、HP、MP、名声、ボーナスポイント #endregion Fields #region Methods // Use this for initialization void Start() { save = GetComponent<Static>(); Canvas = GameObject.Find ("Canvas"); //if (save.GetDay () == 1) { Canvas.GetComponent<uGUI_Msg>().dispMessage(EventText[0]); //} }
// Use this for initialization void Start() { _static = GameObject.FindGameObjectWithTag("Manager").GetComponent<Static>(); pcZ = GameObject.FindGameObjectWithTag("Player").GetComponent<Player_ControllerZ>(); for(int i = 0; i < 3; i++) { istyuto[i] = false; } }
public virtual void AddTrunk() { if( m_Trunk != null ) m_Trunk.Delete(); if( TrunkID > 0 ) { m_TrunkID = TrunkID; m_Trunk = new Static( TrunkID ); m_Trunk.Name = "a tree trunk"; m_Trunk.MoveToWorld( this.Location, this.Map ); } }
public override void Execute( CommandEventArgs args, object o ) { if( o is AddonComponent ) { BaseAddon addon = ((AddonComponent)o).Addon; if( addon.Components.Count > 0 ) { for( int i = 0; i < addon.Components.Count; i++ ) { AddonComponent component = addon.Components[i]; Static newStatic = new Static( component.ItemID ); newStatic.Hue = component.Hue; newStatic.Name = component.Name; newStatic.MoveToWorld( new Point3D( component.Location ), component.Map ); } } addon.Delete(); AddResponse( "The add-on has been converted to static objects." ); } else if( o is Item && !(o is Static) ) { Item i = (Item)o; Static newItem = new Static( i.ItemID ); newItem.Hue = i.Hue; newItem.Layer = i.Layer; newItem.Light = i.Light; newItem.Name = i.Name; newItem.MoveToWorld( new Point3D( i.Location ), i.Map ); if( i.Parent == args.Mobile ) newItem.Bounce( args.Mobile ); if( i is Container ) ((Container)i).Destroy(); else i.Delete(); AddResponse( "The item has been converted to a static." ); } else { LogFailure( "This command only works with non-static items or add-ons." ); } }
/// <summary> /// Builds a structure received from PB /// </summary> /// <param name="account">The account name for the user requesting the builder</param> /// <param name="items">An ArrayList of BuiltItem objects</param> /// <param name="map">The map on which the generation occurs</param> public static void Build( string account, ArrayList items, Map map ) { ArrayList worldItems = new ArrayList(); m_UserData[ account ] = worldItems; foreach( BuildItem bItem in items ) { Static item = new Static( bItem.ID ); item.Hue = bItem.Hue; item.MoveToWorld( new Point3D( bItem.X, bItem.Y, bItem.Z ), map ); worldItems.Add( item ); } }
void Start() { playerController = GetComponent<CharacterController>();//rigidbodyを使う場合は外す animator = GetComponentInChildren<Animator>();//アニメータを使うとき save = GameObject.FindGameObjectWithTag("Manager").GetComponent<Static>(); //HPとMPの引継ぎ H_point = save.H_Point; M_point = save.M_Point; //初期パラメタを保存 max_HP = H_point; max_MP = M_point; base_Pow = power; base_Def = def; base_Sp = speed; base_Ju = jump; }
// Use this for initialization void Start() { guiText = this.GetComponent<Text>(); switch(type){ case Text_Type.Day: _static = GameObject.FindGameObjectWithTag("Manager").GetComponent<Static>(); if (_static.day - (int)_static.day == 0.5f) { guiText.text = (int)_static.day + "日目 夜"; } else { guiText.text = (int)_static.day + "日目 昼"; } break; case Text_Type.LP: _static = GameObject.FindGameObjectWithTag("Manager").GetComponent<Static>(); guiText.text = "名声 " + _static.lank_P; break; case Text_Type.BP: _static = GameObject.FindGameObjectWithTag("Manager").GetComponent<Static>(); guiText.text = "BP " + _static.bonus_P; break; case Text_Type.HP: pcZ = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player_ControllerZ>(); break; case Text_Type.MP: pcZ = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player_ControllerZ>(); break; case Text_Type.Magic: mc = GameObject.FindGameObjectWithTag("Player").GetComponent<Magic_Controller>(); break; case Text_Type.Enemy: ecZ = GameObject.Find("Boss_DarkLilith").GetComponent<Enemy_ControllerZ>(); break; default: break; } }
protected override void OnTarget( Mobile from, object targeted ) { if ( targeted is AddonComponent ) { BaseAddon design = ((AddonComponent)targeted).Addon; if ( design.Components.Count > 0 ) { for ( int i = 0; i < design.Components.Count; ++i ) { AddonComponent component = (AddonComponent)((design.Components)[i]); Static equivalent = new Static( component.HuedItemID ); //( component.ItemID ); equivalent.Location = component.Location; //component.Location; equivalent.Map = component.Map; //component.Map; equivalent.Hue = component.Hue; //component.Map; } } design.Delete(); from.SendMessage("Addon structure statified. You can now freeze it."); } }
protected override void OnTarget(Mobile from, object targeted) { IPoint3D p = targeted as IPoint3D; if ( p != null ) { foreach( BuildItem bItem in m_Items ) { Static item = new Static( bItem.ID ); item.Hue = bItem.Hue; int x = p.X + bItem.X; int y = p.Y + bItem.Y; Map map = from.Map; int z = map.Tiles.GetLandTile( x, y ).Z; item.MoveToWorld( new Point3D( x, y, z ), map ); } from.SendMessage( BoxConfig.MessageHue, "{0} items created.", m_Items.Count ); } }
public virtual bool GetHarvestDetails(Mobile from, Item tool, object toHarvest, out int tileID, out Map map, out Point3D loc) { if (toHarvest is Static && !((Static)toHarvest).Movable) { Static obj = (Static)toHarvest; tileID = (obj.ItemID & 0x3FFF) | 0x4000; map = obj.Map; loc = obj.GetWorldLocation(); } else if (toHarvest is StaticTarget) { StaticTarget obj = (StaticTarget)toHarvest; tileID = (obj.ItemID & 0x3FFF) | 0x4000; map = from.Map; loc = obj.Location; } else if (toHarvest is LandTarget) { LandTarget obj = (LandTarget)toHarvest; tileID = obj.TileID & 0x3FFF; map = from.Map; loc = obj.Location; } else { tileID = 0; map = null; loc = Point3D.Zero; return(false); } return(map != null && map != Map.Internal); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is AddonComponent) { BaseAddon design = ((AddonComponent)targeted).Addon; if (design.Components.Count > 0) { for (int i = 0; i < design.Components.Count; ++i) { AddonComponent component = (AddonComponent)((design.Components)[i]); Static equivalent = new Static(component.HuedItemID); //( component.ItemID ); equivalent.Location = component.Location; //component.Location; equivalent.Map = component.Map; //component.Map; equivalent.Hue = component.Hue; //component.Map; } } design.Delete(); from.SendMessage("Addon structure statified. You can now freeze it."); } else if (targeted == from) { from.SendGump(new Addon2StaticGump(from)); } }
static Code[] CreateCodeValues() { var result = new Code[0x100]; Static.Assert(Code.INVALID == 0 ? 0 : -1); // GENERATOR-BEGIN: D3nowCodeValues // ⚠️This was generated by GENERATOR!🦹♂️ result[0xBF] = Code.D3NOW_Pavgusb_mm_mmm64; result[0xBB] = Code.D3NOW_Pswapd_mm_mmm64; result[0xB7] = Code.D3NOW_Pmulhrw_mm_mmm64; result[0xB6] = Code.D3NOW_Pfrcpit2_mm_mmm64; result[0xB4] = Code.D3NOW_Pfmul_mm_mmm64; result[0xB0] = Code.D3NOW_Pfcmpeq_mm_mmm64; result[0xAE] = Code.D3NOW_Pfacc_mm_mmm64; result[0xAA] = Code.D3NOW_Pfsubr_mm_mmm64; result[0xA7] = Code.D3NOW_Pfrsqit1_mm_mmm64; result[0xA6] = Code.D3NOW_Pfrcpit1_mm_mmm64; result[0xA4] = Code.D3NOW_Pfmax_mm_mmm64; result[0xA0] = Code.D3NOW_Pfcmpgt_mm_mmm64; result[0x9E] = Code.D3NOW_Pfadd_mm_mmm64; result[0x9A] = Code.D3NOW_Pfsub_mm_mmm64; result[0x97] = Code.D3NOW_Pfrsqrt_mm_mmm64; result[0x96] = Code.D3NOW_Pfrcp_mm_mmm64; result[0x94] = Code.D3NOW_Pfmin_mm_mmm64; result[0x90] = Code.D3NOW_Pfcmpge_mm_mmm64; result[0x8E] = Code.D3NOW_Pfpnacc_mm_mmm64; result[0x8A] = Code.D3NOW_Pfnacc_mm_mmm64; result[0x87] = Code.D3NOW_Pfrsqrtv_mm_mmm64; result[0x86] = Code.D3NOW_Pfrcpv_mm_mmm64; result[0x1D] = Code.D3NOW_Pf2id_mm_mmm64; result[0x1C] = Code.D3NOW_Pf2iw_mm_mmm64; result[0x0D] = Code.D3NOW_Pi2fd_mm_mmm64; result[0x0C] = Code.D3NOW_Pi2fw_mm_mmm64; // GENERATOR-END: D3nowCodeValues return(result); }
private void btnPackUse_Click(object sender, EventArgs e) { try { DataTable dt = (DataTable)grdPack.DataSource; var query = from row in dt.AsEnumerable() where row.Field <decimal>("status") == 1 select row; if (query == null || query.Count() == 0) { MessageBox.Show("Багц сонгоно уу."); return; } Result res = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 207, 130136, 130136, new object[] { Static.ToStr(txtAreaCode.EditValue), grdPack.DataSource, 3 }); if (FormUtility.ValidateQuery(res)) { RefreshPos(Static.ToStr(txtAreaCode.EditValue)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static void Setup(CommandEventArgs e) { if (VoidPoolController.InstanceTram != null || VoidPoolController.InstanceFel != null) e.Mobile.SendMessage("This has already been setup!"); else { var one = new VoidPoolController(Map.Trammel); WeakEntityCollection.Add("newcovetous", one); one.MoveToWorld(new Point3D(5605, 1998, 10), Map.Trammel); var two = new VoidPoolController(Map.Felucca); WeakEntityCollection.Add("newcovetous", two); two.MoveToWorld(new Point3D(5605, 1998, 10), Map.Felucca); int id = 0; int hue = 0; for (int x = 5497; x <= 5503; x++) { for (int y = 1995; y <= 2001; y++) { if (x == 5497 && y == 1995) id = 1886; else if (x == 5497 && y == 2001) id = 1887; else if (x == 5503 && y == 1995) id = 1888; else if (x == 5503 && y == 2001) id = 1885; else if (x == 5497) id = 1874; else if (x == 5503) id = 1876; else if (y == 1995) id = 1873; else if (y == 2001) id = 1875; else { //id = 1168; id = Utility.Random(8511, 6); } hue = id >= 8511 ? 0 : 1954; var item = new Static(id); item.Name = "Void Pool"; item.Hue = hue; WeakEntityCollection.Add("newcovetous", item); item.MoveToWorld(new Point3D(x, y, 5), Map.Trammel); item = new Static(id); item.Name = "Void Pool"; item.Hue = hue; WeakEntityCollection.Add("newcovetous", item); item.MoveToWorld(new Point3D(x, y, 5), Map.Felucca); } } XmlSpawner spawner = new XmlSpawner("corathesorceress"); spawner.MoveToWorld(new Point3D(5457, 1808, 0), Map.Trammel); spawner.SpawnRange = 5; spawner.MinDelay = TimeSpan.FromHours(1); spawner.MaxDelay = TimeSpan.FromHours(1.5); spawner.DoRespawn = true; spawner = new XmlSpawner("corathesorceress"); spawner.MoveToWorld(new Point3D(5457, 1808, 0), Map.Felucca); spawner.SpawnRange = 5; spawner.MinDelay = TimeSpan.FromHours(1); spawner.MaxDelay = TimeSpan.FromHours(1.5); spawner.DoRespawn = true; spawner = new XmlSpawner("velathesorceress"); spawner.MoveToWorld(new Point3D(2254, 1207, 0), Map.Trammel); spawner.SpawnRange = 0; spawner.DoRespawn = true; spawner = new XmlSpawner("velathesorceress"); spawner.MoveToWorld(new Point3D(2254, 1207, 0), Map.Felucca); spawner.SpawnRange = 0; spawner.DoRespawn = true; AddWaypoints(); ConvertSpawners(); } }
public Item Construct() { Item item; try { if (m_Type == typeofStatic) { item = new Static(m_ItemID); } else if (m_Type == typeofLocalizedStatic) { int labelNumber = 0; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("LabelNumber")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { labelNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf)); break; } } } item = new LocalizedStatic(m_ItemID, labelNumber); } else { item = (Item)Activator.CreateInstance(m_Type); } } catch (Exception e) { throw new Exception(String.Format("Bad type: {0}", m_Type), e); } if (item is Server.Items.SpawnsOverseer) { Server.Items.SpawnsOverseer sp = (Server.Items.SpawnsOverseer)item; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Range")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.Range = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("InRangeDelay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.InRangeDelay = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("OutRangeDelay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.OutRangeDelay = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } } } item.Movable = false; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Light")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { item.Light = (LightType)Enum.Parse(typeof(LightType), m_Params[i].Substring(++indexOf), true); } } else if (m_Params[i].StartsWith("Hue")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { int hue = Utility.ToInt32(m_Params[i].Substring(++indexOf)); if (item is DyeTub) { ((DyeTub)item).DyedHue = hue; } else { item.Hue = hue; } } } else if (m_Params[i].StartsWith("Name")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { item.Name = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("Amount")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { // Must supress stackable warnings bool wasStackable = item.Stackable; item.Stackable = true; item.Amount = Utility.ToInt32(m_Params[i].Substring(++indexOf)); item.Stackable = wasStackable; } } } return(item); }
void Start() { GameObject staticObgHolder = GameObject.FindGameObjectWithTag("Static"); staticObj = staticObgHolder.GetComponent <Static>(); }
public string PrepareTicket(string rowid, out int printcount) { StringBuilder sb = new StringBuilder(); DataTable dt = null; DataRow r = null; object hash = null; DateTime postdate = DateTime.MinValue; int count = 0; try { #region Биллийн формат файлыг унших string filename = string.Format("{0}\\Bill\\BillFormat.txt", _core.ApplicationPath); if (System.IO.File.Exists(filename)) { string s = System.IO.File.ReadAllText(filename); bool success = false; hash = JSON.JsonDecode(s, ref success); if (!success) { throw new Exception("Биллын формат файл буруу байна."); } } #endregion #region Толгойн custom мэдээллийг унших object hdr = Core.Core.JPathGet((Hashtable)hash, "header"); object ftr = Core.Core.JPathGet((Hashtable)hash, "footer"); if (hdr == null || ftr == null || !(hdr is ArrayList) || !(ftr is ArrayList)) { throw new Exception("Биллын формат файл буруу байна."); } ArrayList list = (ArrayList)hdr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion #region Биллийн толгой бэлдэх dt = _billdata.Tables["Totals"]; if (dt != null && dt.Rows.Count > 0) { r = dt.Rows[0]; string salesno = Static.ToStr(r["SALESNO"]); string cashiername = Static.ToStr(r["USERNAME"]); string posno = Static.ToStr(r["POSNO"]); string posname = Static.ToStr(r["POSNAME"]); int shiftno = Static.ToInt(r["SHIFTNO"]); postdate = Static.ToDateTime(r["POSTDATE"]); sb.Append(" TICKET\r\n"); sb.AppendFormat("{0,-16:yyyy/MM/dd HH:mm} {1,21}\r\n", DateTime.Now, salesno); //sb.AppendFormat("Cashier: {0,-17} POS: {1} ({2})\r\n", cashiername, posno, shiftno); } #endregion #region Биллийн барааны жагсаалт бэлдэх sb.AppendLine("========================================"); sb.AppendLine(""); dt = _billdata.Tables["Tickets"]; if (dt != null && dt.Rows.Count > 0) { string[] a = rowid.Split(new string[] { "~" }, StringSplitOptions.RemoveEmptyEntries); int rowindex = Static.ToInt(a[0]); if (dt.Rows.Count > rowindex) { r = dt.Rows[rowindex]; string prodname = Static.ToStr(r["PRODNAME"]); int qty = Static.ToInt(r["QTY"]); int servicetime = Static.ToInt(r["SERVICETIME"]); DateTime endtime = postdate.AddMinutes(servicetime); count = qty; sb.AppendFormat("Service : {0}\r\n", Static.SubStr(prodname, 0, 26)); sb.AppendFormat("Duration : {0} minutes\r\n", servicetime); sb.AppendLine(); sb.AppendFormat("Start time : {0}\r\n", postdate.ToString("yyyy/MM/dd HH:mm")); sb.AppendFormat("End time : {0}\r\n", endtime.ToString("yyyy/MM/dd HH:mm")); sb.AppendLine(); } } sb.AppendLine("========================================"); #endregion #region Биллийн сүүл бэлдэх list = (ArrayList)ftr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion } catch (Exception ex) { _core.AlertShow("Билл Хэвлэх", ex.Message); } //System.IO.File.WriteAllText("c:\\bill3.txt", sb.ToString()); printcount = count; return(sb.ToString()); }
/// <summary> /// Sets a static effect on this device. /// </summary> /// <param name="effect">Effect options.</param> public void SetStatic(Static effect) { SetGuid(NativeWrapper.CreateDeviceEffect(DeviceId, Effect.Static, effect)); }
private static void PickerCallback(Mobile from, Map map, Point3D start, Point3D end, object state) { object[] args = state as object[]; int m_SimpleComponents = 0; int m_ComplexComponents = 0; int m_NamedComponents = 0; int m_TotalComponents = 0; if (start.X > end.X) { int x = start.X; start.X = end.X; end.X = x; } if (start.Y > end.Y) { int y = start.Y; start.Y = end.Y; end.Y = y; } Rectangle2D bounds = new Rectangle2D(start, end); string name = args[0] as string; string ns = args[1] as string; bool getStatics = (bool)args[2]; bool getItems = (bool)args[3]; bool getTiles = (bool)args[4]; bool includeStaticRange = (bool)args[5]; bool includeItemRange = (bool)args[6]; bool includeTileRange = (bool)args[7]; bool includeZRange = (bool)args[8]; bool generateTest = (bool)args[17]; sbyte min = sbyte.MinValue; sbyte max = sbyte.MaxValue; short minStaticID = 2; short maxStaticID = 16384; short minItemID = 2; short maxItemID = 16384; short minTileID = 2; short maxTileID = 16384; try { min = sbyte.Parse(args[9] as string); } catch { } try { max = sbyte.Parse(args[10] as string); } catch { } try { minStaticID = short.Parse(args[11] as string); } catch { } try { maxStaticID = short.Parse(args[12] as string); } catch { } try { minItemID = short.Parse(args[13] as string); } catch { } try { maxItemID = short.Parse(args[14] as string); } catch { } try { minTileID = short.Parse(args[15] as string); } catch { } try { maxTileID = short.Parse(args[16] as string); } catch { } Hashtable tiles = new Hashtable(); if (getTiles) { for (int x = start.X; x <= end.X; x++) { for (int y = start.Y; y <= end.Y; y++) { #if RC2 StaticTile[] stlist = map.Tiles.GetStaticTiles(x, y, true); List <Server.StaticTile> list = new List <Server.StaticTile>(); List <Server.StaticTile> remove = new List <Server.StaticTile>(); #else ArrayList list = map.GetTilesAt(new Point2D(x, y), false, false, true); ArrayList remove = new ArrayList(); #endif foreach (StaticTile t in stlist) { list.Add(t); int id = t.ID - 16384; if (id < 2 || id > 16382) { remove.Add(t); } else if (includeZRange && (t.Z < min || t.Z > max)) { remove.Add(t); } else if (!includeZRange && (t.Z >= min && t.Z <= max)) { remove.Add(t); } else if (includeTileRange && (id < minTileID || id > maxTileID)) { remove.Add(t); } else if (!includeTileRange && (id >= minTileID && id <= maxTileID)) { remove.Add(t); } } foreach (StaticTile t in remove) { list.Remove(t); } if (list != null && list.Count > 0) { tiles[new Point2D(x, y)] = list; } } } } IPooledEnumerable en = map.GetItemsInBounds(bounds); ArrayList target = new ArrayList(); bool fail = false; try { foreach (object o in en) { if (getStatics) { Static s = o as Static; if (s == null) { } else if (s.Deleted) { } else if (includeZRange && (s.Z < min || s.Z > max)) { continue; } else if (!includeZRange && (s.Z >= min && s.Z <= max)) { continue; } else if (includeStaticRange && (s.ItemID < minStaticID || s.ItemID > maxStaticID)) { continue; } else if (!includeStaticRange && (s.ItemID >= minStaticID && s.ItemID <= maxStaticID)) { continue; } else { target.Add(o); #if DEBUG Console.WriteLine("Static={0}:{1}", s.GetType().ToString(), s.ItemID); #endif continue; } } if (getItems) { Static s = o as Static; if (s != null) // Don't want a static { continue; } Item i = o as Item; if (i == null) { continue; } else if (i.Deleted) { continue; } else if (i is BaseAddon) // Not a good idea to add a BaseAddOn for obvious reasons { continue; } else if (i.ItemID < 2 || i.ItemID > 16382) // This is not an Item within the normal artwork.. multi... etc.. Toss it { continue; } else if (includeZRange && (i.Z < min || i.Z > max)) { continue; } else if (!includeZRange && (i.Z >= min && i.Z <= max)) { continue; } else if (includeItemRange && (i.ItemID < minItemID || i.ItemID > maxItemID)) { continue; } else if (!includeItemRange && (i.ItemID >= minItemID && i.ItemID <= maxItemID)) { continue; } #if DEBUG Console.WriteLine("item={0}:{1}, {2}-map{3}", i.GetType().ToString(), i.ItemID, i.Deleted, i.Map); #endif target.Add(o); } } } catch (Exception err) { Console.WriteLine(err.ToString()); from.SendMessage(0x40, "The targeted components have been modified. Please retry."); fail = true; } finally { en.Free(); } if (fail) { return; } if (target.Count == 0 && tiles.Keys.Count == 0) { from.SendMessage(0x40, "No components have been selected."); from.SendGump(new InternalGump(from, args)); return; } // Get center Point3D center = new Point3D(); center.Z = 127; int x1 = bounds.End.X; int y1 = bounds.End.Y; int x2 = bounds.Start.X; int y2 = bounds.Start.Y; // Get correct bounds foreach (Item item in target) { if (item.Z < center.Z) { center.Z = item.Z; } x1 = Math.Min(x1, item.X); y1 = Math.Min(y1, item.Y); x2 = Math.Max(x2, item.X); y2 = Math.Max(y2, item.Y); } CEOIdentifyAddon IdentifyAddon = null; if (generateTest) { IdentifyAddon = new CEOIdentifyAddon("init"); } foreach (Point2D p in tiles.Keys) { #if RC2 List <Server.StaticTile> list = tiles[p] as List <Server.StaticTile>; #else ArrayList list = tiles[p] as ArrayList; #endif if (list == null) { Console.WriteLine("The list is null... "); return; } foreach (StaticTile t in list) { if (t.Z < center.Z) { center.Z = t.Z; } } x1 = Math.Min(x1, p.X); y1 = Math.Min(y1, p.Y); x2 = Math.Max(x2, p.X); y2 = Math.Max(y2, p.Y); } center.X = x1 + ((x2 - x1) / 2); center.Y = y1 + ((y2 - y1) / 2); // Build items System.Text.StringBuilder nc = new System.Text.StringBuilder(); nc.Append("\n"); System.Text.StringBuilder sl = new System.Text.StringBuilder(); sl.Append("private static int[,] m_AddOnSimpleComponents = new int[,] {\n\t\t\t "); System.Text.StringBuilder cl = new System.Text.StringBuilder(); cl.Append("private static int[,] m_AddOnComplexComponents = new int[,] {\n\t\t\t "); System.Text.StringBuilder sc = new System.Text.StringBuilder(); sc.Append("// "); System.Text.StringBuilder cc = new System.Text.StringBuilder(); cc.Append("// "); int simplecount = 0; int complexcount = 0; // Tiles foreach (Point2D p in tiles.Keys) { #if RC2 List <Server.StaticTile> list = tiles[p] as List <Server.StaticTile>; #else ArrayList list = tiles[p] as ArrayList; #endif int xOffset = p.X - center.X; int yOffset = p.Y - center.Y; foreach (StaticTile t in list) { int zOffset = t.Z - center.Z; int id = t.ID - 16384; m_SimpleComponents++; simplecount++; m_TotalComponents++; sc.AppendFormat("{0}\t ", m_TotalComponents); if (simplecount > 1) { sl.Append(", "); } sl.Append("{"); sl.AppendFormat("{0}, {1}, {2}, {3}", id, xOffset, yOffset, zOffset); sl.Append("}"); if (simplecount % 3 == 0) { sl.AppendFormat("{0}\n\t\t\t", sc.ToString()); sc.Length = 0; sc.Append("// "); } if (generateTest) { AddIdentifyAddOnComponent(IdentifyAddon, id, xOffset, yOffset, zOffset, 0, -1, string.Format("({0}):{1},{2},{3}", m_TotalComponents, xOffset, yOffset, zOffset), 0); } } } // Statics & Items foreach (Item item in target) { if (item.Deleted) { continue; } int xOffset = item.X - center.X; int yOffset = item.Y - center.Y; int zOffset = item.Z - center.Z; int id = item.ItemID; if (((item.ItemData.Flags & TileFlag.LightSource) == TileFlag.LightSource) || (item.Hue != 0) || (item.Name != null) || item.Amount > 1) // Use old method { if (item.Name != null || item.Amount != 0) // Have to do this one the old method { m_NamedComponents++; m_TotalComponents++; int lightsource = -1; if ((item.ItemData.Flags & TileFlag.LightSource) == TileFlag.LightSource) { lightsource = (int)item.Light; } nc.AppendFormat("\t\t\tAddComplexComponent( (BaseAddon) this, {0}, {1}, {2}, {3}, {4}, {5}, \"{6}\", {7});// {8}\n", id, xOffset, yOffset, zOffset, item.Hue, lightsource, item.Name, item.Amount, m_TotalComponents); if (generateTest) { AddIdentifyAddOnComponent(IdentifyAddon, id, xOffset, yOffset, zOffset, item.Hue, -1, string.Format("({0},{1}): {2}, {3}, {4}", m_TotalComponents, id, xOffset, yOffset, zOffset), item.Amount); } } else //if (item.Hue != 0 || (item.ItemData.Flags & TileFlag.LightSource) == TileFlag.LightSource) { int lightsource = -1; if ((item.ItemData.Flags & TileFlag.LightSource) == TileFlag.LightSource) { lightsource = (int)item.Light; } m_ComplexComponents++; m_TotalComponents++; cc.AppendFormat("{0}\t", m_TotalComponents); complexcount++; if (complexcount > 1) { cl.Append(", "); } cl.Append("{"); cl.AppendFormat("{0}, {1}, {2}, {3}, {4}, {5} ", id, xOffset, yOffset, zOffset, item.Hue, lightsource); cl.Append("}"); if (complexcount % 3 == 0) { cl.AppendFormat("{0}\n\t\t\t", cc.ToString()); cc.Length = 0; cc.Append("// "); } if (generateTest) { AddIdentifyAddOnComponent(IdentifyAddon, id, xOffset, yOffset, zOffset, item.Hue, -1, string.Format("({0},{1}): {2}, {3}, {4}", m_TotalComponents, id, xOffset, yOffset, zOffset), 0); } } } else // Add data to static table { m_SimpleComponents++; m_TotalComponents++; sc.AppendFormat("{0}\t", m_TotalComponents); simplecount++; if (simplecount > 1) { sl.Append(", "); } sl.Append("{"); sl.AppendFormat("{0}, {1}, {2}, {3}", id, xOffset, yOffset, zOffset); sl.Append("}"); if (simplecount % 3 == 0) { sl.AppendFormat("{0}\n\t\t\t", sc.ToString()); sc.Length = 0; sc.Append("// "); } if (generateTest) { AddIdentifyAddOnComponent(IdentifyAddon, id, xOffset, yOffset, zOffset, item.Hue, -1, string.Format("({0},{1}): {2}, {3}, {4}", m_TotalComponents, id, xOffset, yOffset, zOffset), 0); } } } if (sc.Length > 4) { sl.AppendFormat("{0}\n", sc.ToString()); } if (cc.Length > 4) { cl.AppendFormat("{0}\n", cc.ToString()); } if (m_SimpleComponents > 0) { sl.Append("\t\t};\n\n"); } if (m_ComplexComponents > 0) { cl.Append("\t\t};\n\n"); } string output = m_Template.Replace("{name}", name); output = output.Replace("{simplelist}", m_SimpleComponents > 0 ? sl.ToString() : ""); output = output.Replace("{simplecomponentscode}", m_SimpleComponents > 0 ? m_SimpleCode : ""); output = output.Replace("{complexlist}", m_ComplexComponents > 0 ? cl.ToString() : ""); output = output.Replace("{complexcomponentscode}", m_ComplexComponents > 0 ? m_ComplexCode : ""); output = output.Replace("{namedcomponentscode}", m_NamedComponents > 0 ? nc.ToString() : ""); output = output.Replace("{complexnamecomponentscode}", (m_ComplexComponents > 0 || m_NamedComponents > 0) ? m_ComplexNameCode : ""); output = output.Replace("{namespace}", ns); StreamWriter writer = null; string path = null; if (m_CustomOutputDirectory != null) { path = Path.Combine(m_CustomOutputDirectory, string.Format(@"TheBox\{0}Addon.cs", name)); } else { path = Path.Combine(Core.BaseDirectory, string.Format(@"TheBox\{0}Addon.cs", name)); } fail = false; try { string folder = Path.GetDirectoryName(path); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } writer = new StreamWriter(path, false); writer.Write(output); } catch { from.SendMessage(0x40, "An error occurred when writing the file."); fail = true; } finally { if (writer != null) { writer.Close(); } } if (!fail) { from.SendMessage(0x40, "Script saved to {0}", path); from.SendMessage(0x40, "Total components in AddOn: {0}", m_TotalComponents); if (generateTest && IdentifyAddon != null) { from.SendMessage(0x37, "Now target a land tile to place a your addon."); from.Target = new InternalTarget(IdentifyAddon); } } }
public string PrepareBill() { StringBuilder sb = new StringBuilder(); DataTable dt = null; DataRow r = null; object hash = null; decimal sa = 0; decimal dp = 0; decimal ds = 0; decimal ta = 0; decimal vat = 0; decimal paid = 0; try { #region Биллийн формат файлыг унших string filename = string.Format("{0}\\Bill\\BillFormat.txt", _core.ApplicationPath); if (System.IO.File.Exists(filename)) { string s = System.IO.File.ReadAllText(filename); bool success = false; hash = JSON.JsonDecode(s, ref success); if (!success) { throw new Exception("Биллын формат файл буруу байна."); } } #endregion #region Толгойн custom мэдээллийг унших object hdr = Core.Core.JPathGet((Hashtable)hash, "header"); object ftr = Core.Core.JPathGet((Hashtable)hash, "footer"); if (hdr == null || ftr == null || !(hdr is ArrayList) || !(ftr is ArrayList)) { throw new Exception("Биллын формат файл буруу байна."); } ArrayList list = (ArrayList)hdr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion #region Толгойн мэдээлэл dt = _billdata.Tables["Totals"]; if (dt != null && dt.Rows.Count > 0) { r = dt.Rows[0]; string salesno = Static.ToStr(r["SALESNO"]); string cashiername = Static.ToStr(r["USERNAME"]); DateTime postdate = Static.ToDateTime(r["POSTDATE"]); string posno = Static.ToStr(r["POSNO"]); string posname = Static.ToStr(r["POSNAME"]); int shiftno = Static.ToInt(r["SHIFTNO"]); posname = " ".PadLeft((40 - posname.Length) / 2) + posname; sb.AppendFormat("{0}\r\n", posname.ToUpper()); sb.AppendFormat("{0,-16:yyyy/MM/dd HH:mm} {1,21}\r\n", DateTime.Now, salesno); sb.AppendFormat("Cashier: {0,-17} POS: {1} ({2})\r\n", cashiername, posno, shiftno); sa = Static.ToDecimal(r["SA"]); dp = Static.ToDecimal(r["DP"]); ds = Static.ToDecimal(r["DS"]); vat = Static.ToDecimal(r["VAT"]); paid = Static.ToDecimal(r["PAID"]); ta = sa - dp - ds; } #endregion #region Биллийн барааны жагсаалт бэлдэх sb.AppendLine("========================================"); sb.AppendLine(" Item Price Qty Amount"); sb.AppendLine("----------------------------------------"); dt = _billdata.Tables["Products"]; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { sb.AppendFormat("{0,-21}{1,6}*{2,4}={3,7:###0}\r\n" , Static.SubStr(Static.ToStr(row["PRODNAME"]), 0, 21) , row["PRICE"] , row["QTY"] , row["SALESAMOUNT"] ); } } sb.AppendLine("========================================"); sb.AppendFormat("Total : {0,28:#,##0}\r\n", sa); sb.AppendFormat("Discount : {0,28:#,##0}\r\n", dp + ds); sb.AppendLine("----------------------------------------"); sb.AppendFormat("NetPrice : {0,28:#,##0}\r\n", ta); sb.AppendFormat("VAT : {0,28:#,##0}\r\n", vat); sb.AppendLine("----------------------------------------"); #endregion #region Биллийн төлбөрийн жагсаалт бэлдэх dt = _billdata.Tables["Payments"]; if (dt != null && dt.Rows.Count > 0) { //decimal paid = 0; foreach (DataRow row in dt.Rows) { decimal amount = Static.ToDecimal(row["AMOUNT"]); int pflag = Static.ToInt(row["PAYMENTFLAG" /*"PAYMENTFLAG"*/]); string pname = Static.ToStr(row["PAYMENTNAME"]); string preg = Static.ToStr(row["SOURCENO"]); string ptype = Static.ToStr("FLAG"); //paid += amount; if (pflag == 0) { pname = "CASH"; } else if (pflag == 1) { pname = "IPPOS"; } if (ptype == "E") { preg = "CHANGE"; } if (ptype == "R") { preg = "REFUND"; } sb.AppendFormat("{0,-12}{1,-12}{2,16:#,##0}\r\n" , Static.SubStr(pname, 0, 10) , Static.SubStr(preg, 0, 12) , amount ); } if (paid < ta) { sb.AppendLine(); sb.AppendFormat("UNPAID AMOUNT {0,25:#,##0}", ta - paid); sb.AppendLine(); } sb.AppendLine("========================================"); } #endregion #region Биллийн сүүл бэлдэх list = (ArrayList)ftr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion } catch (Exception ex) { _core.AlertShow("Билл Хэвлэх", ex.Message); } //System.IO.File.WriteAllText("c:\\bill1.txt", sb.ToString()); return(sb.ToString()); }
public static void ShowSpawnPoints_OnCommand( CommandEventArgs e ) { ArrayList ToShow = new ArrayList(); foreach( Item item in World.Items.Values ) { if( item is XmlSpawner ) { //turned off visibility. Admins will still see masts but players will not. item.Visible = false; // set the spawn item visibility item.Movable = false; // Make the spawn item movable item.Hue = 88; // Bright blue colour so its easy to spot item.ItemID = ShowItemId; // Ship Mast (Very tall, easy to see if beneath other objects) // find container-held spawners to be marked with an external static if( (item.Parent != null) && (item.RootParent is Container) ) { ToShow.Add( item ); } } } // place the statics foreach( Item i in ToShow ) { XmlSpawner xml_item = (XmlSpawner)i; // does the spawner already have a static attached to it? could happen if two showall commands are issued in a row. // if so then dont add another if( (xml_item.m_ShowContainerStatic == null || xml_item.m_ShowContainerStatic.Deleted) && xml_item.RootParent is Container ) { Container root_item = xml_item.RootParent as Container; // calculate a world location for the static. Position it just above the container int x = root_item.Location.X; int y = root_item.Location.Y; int z = root_item.Location.Z + 10; Static s = new Static( ShowItemId ); s.Visible = false; s.MoveToWorld( new Point3D( x, y, z ), root_item.Map ); xml_item.m_ShowContainerStatic = s; } } }
/// <summary> /// Sets a new static effect on the headset. /// </summary> /// <param name="effect"> /// An instance of the <see cref="Static" /> struct /// describing the effect. /// </param> public void SetStatic(Static effect) { SetGuid(NativeWrapper.CreateHeadsetEffect(Effect.Static, effect)); }
public void PropertyHelper_DoesNotFindStaticProperties() { // Arrange var anonymous = new Static(); // Act + Assert var helper = Assert.Single(PropertyHelper.GetProperties(anonymous)); Assert.Equal("Prop5", helper.Name); }
public Builder SetClienttype(Static.ClientType value) { PrepareBuilder(); result.hasClienttype = true; result.clienttype_ = value; return this; }
public override void IncreaseTier() { base.IncreaseTier(); List<object> list = new List<object>(); Item c; switch ( Tier ) { case 1: // easel with canvas c = new Static( 0xF66 ); c.MoveToWorld( new Point3D( 1417, 1602, 30 ), Map ); list.Add( c ); // table c = new Static( 0xB6B ); c.MoveToWorld( new Point3D( 1417, 1606, 30 ), Map ); list.Add( c ); c = new Static( 0xB6D ); c.MoveToWorld( new Point3D( 1417, 1605, 30 ), Map ); list.Add( c ); c = new Static( 0xB6C ); c.MoveToWorld( new Point3D( 1417, 1604, 30 ), Map ); list.Add( c ); // bonsai tree c = new Static( 0x28DC ); c.MoveToWorld( new Point3D( 1417, 1604, 36 ), Map ); list.Add( c ); // bottles c = new Static( 0xE29 ); c.MoveToWorld( new Point3D( 1417, 1605, 37 ), Map ); list.Add( c ); c = new Static( 0xE28 ); c.MoveToWorld( new Point3D( 1417, 1605, 36 ), Map ); list.Add( c ); c = new Static( 0xE2C ); c.MoveToWorld( new Point3D( 1417, 1606, 37 ), Map ); list.Add( c ); // pen and ink c = new Static( 0xFBF ); c.MoveToWorld( new Point3D( 1417, 1606, 36 ), Map ); list.Add( c ); // cooking book c = new Static( 0xFBE ); c.MoveToWorld( new Point3D( 1418, 1606, 42 ), Map ); c.Name = "A Cookbook"; list.Add( c ); break; } if ( list.Count > 0 ) Tiers.Add( list ); }
public TerathanMatriarch() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 ) { Name = "a terathan matriarch"; Body = 72; LastTimeSpoken = DateTime.Now; BaseSoundID = 599; SpeechHue= 1549; SetStr( 316, 405 ); SetDex( 96, 115 ); SetInt( 366, 455 ); SetHits( 190, 243 ); SetDamage( 11, 14 ); SetSkill( SkillName.EvalInt, 90.1, 150.0 ); SetSkill( SkillName.Magery, 90.1, 100.0 ); SetSkill( SkillName.MagicResist, 90.1, 100.0 ); SetSkill( SkillName.Tactics, 50.1, 70.0 ); SetSkill( SkillName.Wrestling, 60.1, 80.0 ); Fame = 10000; Karma = -10000; VirtualArmor = 45; Item item = null; switch( Utility.Random(1000) ) { case 0: PackItem( item = new Static(0x1237) ); break; case 1: PackItem( item = new Static(0x1238) ); break; case 2: PackItem( item = new Static(0x1239) ); break; } if (item != null) item.Movable = true; PackGold( 350, 400 ); PackItem( new SpidersSilk( 5 ) ); PackScroll( 1, 8 ); switch ( Utility.Random( 2 ) ) { case 0: PackWeapon( 0, 5 ); break; case 1: PackArmor( 0, 5 ); break; } switch ( Utility.Random( 2 ) ) { case 0: PackWeapon( 0, 5 ); break; case 1: PackArmor( 0, 5 ); break; } switch ( Utility.Random( 4 ) ) { case 0: PackWeapon( 0, 5 ); break; case 1: PackArmor( 0, 5 ); break; } switch ( Utility.Random( 5 ) ) { case 0: PackWeapon( 0, 5 ); break; case 1: PackArmor( 0, 5 ); break; } if ( 0.20 > Utility.RandomDouble() ) PackItem( new TribalBerry() ); if ( 0.01 > Utility.RandomDouble() ) PackItem( new InvisHat() ); }
public override void IncreaseTier() { base.IncreaseTier(); List<object> list = new List<object>(); Item c; switch ( Tier ) { case 1: // brush c = new Static( 0x1373 ); c.MoveToWorld( new Point3D( 1415, 1593, 67 ), Map ); list.Add( c ); // horse shoes c = new Static( 0xFB6 ); c.MoveToWorld( new Point3D( 1415, 1595, 50 ), Map ); list.Add( c ); // bridle c = new Static( 0x1375 ); c.MoveToWorld( new Point3D( 1416, 1593, 67 ), Map ); list.Add( c ); // brush c = new Static( 0x1372 ); c.MoveToWorld( new Point3D( 1417, 1593, 67 ), Map ); list.Add( c ); // horse barding c = new Static( 0x1378 ); c.MoveToWorld( new Point3D( 1417, 1595, 50 ), Map ); list.Add( c ); c = new Static( 0x1379 ); c.MoveToWorld( new Point3D( 1417, 1594, 50 ), Map ); list.Add( c ); // shepard's crook c = new ShepherdsCrook(); c.MoveToWorld( new Point3D( 1417, 1597, 58 ), Map ); break; } if ( list.Count > 0 ) Tiers.Add( list ); }
/// <summary> /// Sets a static color effect on the mouse pad. /// </summary> /// <param name="effect">An instance of the <see cref="Static" /> struct.</param> public void SetStatic(Static effect) { SetGuid(NativeWrapper.CreateMousepadEffect(Effect.Static, effect)); }
void _core_EventDateChanged(DateTime TxnDate) { txtTxnDate.Text = Static.ToStr(TxnDate.Year) + "." + Static.ToStr(TxnDate.Month).PadLeft(2, '0') + "." + Static.ToStr(TxnDate.Day).PadLeft(2, '0'); }
public Item Construct() { Item item; try { if ( m_Type == typeofStatic ) { item = new Static( m_ItemID ); } else if ( m_Type == typeofLocalizedStatic ) { int labelNumber = 0; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "LabelNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) { labelNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); break; } } } item = new LocalizedStatic( m_ItemID, labelNumber ); } else if ( m_Type == typeofLocalizedSign ) { int labelNumber = 0; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "LabelNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) { labelNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); break; } } } item = new LocalizedSign( m_ItemID, labelNumber ); } else if ( m_Type == typeofAnkhWest || m_Type == typeofAnkhEast ) { bool bloodied = false; for ( int i = 0; !bloodied && i < m_Params.Length; ++i ) bloodied = ( m_Params[i] == "Bloodied" ); if ( m_Type == typeofAnkhWest ) item = new AnkhWest( bloodied ); else item = new AnkhEast( bloodied ); } else if ( m_Type == typeofMarkContainer ) { bool bone = false; bool locked = false; Map map = Map.Malas; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i] == "Bone" ) { bone = true; } else if ( m_Params[i] == "Locked" ) { locked = true; } else if ( m_Params[i].StartsWith( "TargetMap" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) map = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } } MarkContainer mc = new MarkContainer( bone, locked ); mc.TargetMap = map; mc.Description = "strange location"; item = mc; } else if ( m_Type == typeofHintItem ) { int range = 0; int messageNumber = 0; string messageString = null; int hintNumber = 0; string hintString = null; TimeSpan resetDelay = TimeSpan.Zero; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Range" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "WarningString" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) messageString = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "WarningNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) messageNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "HintString" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) hintString = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "HintNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) hintNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "ResetDelay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) resetDelay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } HintItem hi = new HintItem( m_ItemID, range, messageNumber, hintNumber ); hi.WarningString = messageString; hi.HintString = hintString; hi.ResetDelay = resetDelay; item = hi; } else if ( m_Type == typeofWarningItem ) { int range = 0; int messageNumber = 0; string messageString = null; TimeSpan resetDelay = TimeSpan.Zero; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Range" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "WarningString" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) messageString = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "WarningNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) messageNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "ResetDelay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) resetDelay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } WarningItem wi = new WarningItem( m_ItemID, range, messageNumber ); wi.WarningString = messageString; wi.ResetDelay = resetDelay; item = wi; } else if ( m_Type == typeofCannon ) { CannonDirection direction = CannonDirection.North; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "CannonDirection" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) direction = (CannonDirection)Enum.Parse( typeof( CannonDirection ), m_Params[i].Substring( ++indexOf ), true ); } } item = new Cannon( direction ); } else if ( m_Type == typeofSerpentPillar ) { string word = null; Rectangle2D destination = new Rectangle2D(); for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Word" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) word = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "DestStart" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) destination.Start = Point2D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEnd" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) destination.End = Point2D.Parse( m_Params[i].Substring( ++indexOf ) ); } } item = new SerpentPillar( word, destination ); } else if ( m_Type.IsSubclassOf( typeofBeverage ) ) { BeverageType content = BeverageType.Liquor; bool fill = false; for ( int i = 0; !fill && i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Content" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) { content = (BeverageType)Enum.Parse( typeof( BeverageType ), m_Params[i].Substring( ++indexOf ), true ); fill = true; } } } if ( fill ) item = (Item)Activator.CreateInstance( m_Type, new object[]{ content } ); else item = (Item)Activator.CreateInstance( m_Type ); } else if ( m_Type.IsSubclassOf( typeofBaseDoor ) ) { DoorFacing facing = DoorFacing.WestCW; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Facing" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) { facing = (DoorFacing)Enum.Parse( typeof( DoorFacing ), m_Params[i].Substring( ++indexOf ), true ); break; } } } item = (Item)Activator.CreateInstance( m_Type, new object[]{ facing } ); } else { item = (Item)Activator.CreateInstance( m_Type ); } } catch ( Exception e ) { throw new Exception( String.Format( "Bad type: {0}", m_Type ), e ); } if ( item is BaseAddon ) { if ( item is MaabusCoffin ) { MaabusCoffin coffin = (MaabusCoffin)item; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "SpawnLocation" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) coffin.SpawnLocation = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } } } else if ( m_ItemID > 0 ) { List<AddonComponent> comps = ((BaseAddon)item).Components; for ( int i = 0; i < comps.Count; ++i ) { AddonComponent comp = (AddonComponent)comps[i]; if ( comp.Offset == Point3D.Zero ) comp.ItemID = m_ItemID; } } } else if ( item is BaseLight ) { bool unlit = false; for ( int i = 0; !unlit && i < m_Params.Length; ++i ) unlit = ( m_Params[i] == "Unlit" ); if ( !unlit ) ((BaseLight)item).Ignite(); ((BaseLight)item).Protected = true; if ( m_ItemID > 0 ) item.ItemID = m_ItemID; } else if ( item is Server.Mobiles.Spawner ) { Server.Mobiles.Spawner sp = (Server.Mobiles.Spawner)item; sp.NextSpawn = TimeSpan.Zero; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Spawn" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.CreaturesName.Add( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MinDelay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.MinDelay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MaxDelay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.MaxDelay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "NextSpawn" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.NextSpawn = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Count" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.Count = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Team" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.Team = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "HomeRange" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.HomeRange = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Running" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.Running = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Group" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) sp.Group = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } } } else if ( item is RecallRune ) { RecallRune rune = (RecallRune)item; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Description" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) rune.Description = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "Marked" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) rune.Marked = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "TargetMap" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) rune.TargetMap = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Target" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) rune.Target = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } } } else if ( item is SkillTeleporter ) { SkillTeleporter tp = (SkillTeleporter)item; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Skill" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Skill = (SkillName)Enum.Parse( typeof( SkillName ), m_Params[i].Substring( ++indexOf ), true ); } else if ( m_Params[i].StartsWith( "RequiredFixedPoint" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Required = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ) * 0.01; } else if ( m_Params[i].StartsWith( "Required" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Required = Utility.ToDouble( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MessageString" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.MessageString = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "MessageNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.MessageNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "PointDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MapDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Creatures" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SourceEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SoundID" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Delay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } if ( m_ItemID > 0 ) item.ItemID = m_ItemID; } else if ( item is KeywordTeleporter ) { KeywordTeleporter tp = (KeywordTeleporter)item; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Substring" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Substring = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "Keyword" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Keyword = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Range" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "PointDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MapDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Creatures" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SourceEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SoundID" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Delay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } if ( m_ItemID > 0 ) item.ItemID = m_ItemID; } else if ( item is Teleporter ) { Teleporter tp = (Teleporter)item; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "PointDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MapDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Creatures" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SourceEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SoundID" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Delay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) tp.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } if ( m_ItemID > 0 ) item.ItemID = m_ItemID; } else if ( item is FillableContainer ) { FillableContainer cont = (FillableContainer) item; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "ContentType" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) cont.ContentType = (FillableContentType)Enum.Parse( typeof( FillableContentType ), m_Params[i].Substring( ++indexOf ), true ); } } if ( m_ItemID > 0 ) item.ItemID = m_ItemID; } else if ( m_ItemID > 0 ) { item.ItemID = m_ItemID; } item.Movable = false; for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Light" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) item.Light = (LightType)Enum.Parse( typeof( LightType ), m_Params[i].Substring( ++indexOf ), true ); } else if ( m_Params[i].StartsWith( "Hue" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) { int hue = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); if ( item is DyeTub ) ((DyeTub)item).DyedHue = hue; else item.Hue = hue; } } else if ( m_Params[i].StartsWith( "Name" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) item.Name = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "Amount" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) { // Must supress stackable warnings bool wasStackable = item.Stackable; item.Stackable = true; item.Amount = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); item.Stackable = wasStackable; } } } return item; }
public void Awake(){ instance=this; }
public override bool OnSellItems(Mobile seller, List <SellItemResponse> list) { if (!Trading || CashType == null || !CashType.IsNotNull) { return(false); } if (!IsActiveBuyer) { return(false); } if (!seller.CheckAlive()) { return(false); } if (!CheckVendorAccess(seller)) { Say("I can't serve you! Company policy."); //Say(501522); // I shall not treat with scum like thee! return(false); } seller.PlaySound(0x32); var info = GetSellInfo(); var buyInfo = GetBuyInfo(); var giveCurrency = 0; Container cont; var finalList = list.Where(resp => CanSell(seller, info, resp)).ToArray(); if (finalList.Length > 500) { SayTo(seller, true, "You may only sell 500 items at a time!"); return(false); } if (finalList.Length == 0) { return(true); } foreach (var resp in finalList) { foreach (var ssi in info) { if (!ssi.IsSellable(resp.Item)) { continue; } var amount = resp.Amount; if (amount > resp.Item.Amount) { amount = resp.Item.Amount; } var worth = GetSellPrice(seller, ssi, resp) * amount; if (ssi.IsResellable(resp.Item)) { var found = false; if (buyInfo.Any(bii => bii.Restock(resp.Item, amount))) { resp.Item.Consume(amount); found = true; } if (!found) { cont = BuyPack; if (amount < resp.Item.Amount) { var item = LiftItemDupe(resp.Item, resp.Item.Amount - amount); if (item != null) { item.SetLastMoved(); if (!cont.TryDropItem(this, resp.Item, false)) { resp.Item.Delete(); } } else { resp.Item.SetLastMoved(); if (!cont.TryDropItem(this, resp.Item, false)) { resp.Item.Delete(); } } } else { resp.Item.SetLastMoved(); if (!cont.TryDropItem(this, resp.Item, false)) { resp.Item.Delete(); } } } } else { if (amount < resp.Item.Amount) { resp.Item.Amount -= amount; } else { resp.Item.Delete(); } } giveCurrency += worth; break; } } if (giveCurrency <= 0) { return(false); } while (giveCurrency > 0) { Item c = null; if (CashType.TypeEquals <ObjectProperty>()) { var cashSource = GetCashObject(seller) ?? seller; if (!CashProperty.Add(cashSource, giveCurrency)) { c = new Static(0x14F0, 1) { Name = String.Format("Staff I.O.U [{0} {1}]", giveCurrency.ToString("#,0"), CashName.GetString(seller)), Hue = 85, Movable = true, BlessedFor = seller, LootType = LootType.Blessed }; } giveCurrency = 0; } if (c == null && giveCurrency > 0) { c = CashType.CreateInstance <Item>(); if (c == null) { c = new Static(0x14F0, 1) { Name = String.Format("Staff I.O.U [{0} {1}]", giveCurrency.ToString("#,0"), CashName.GetString(seller)), Hue = 85, Movable = true, BlessedFor = seller, LootType = LootType.Blessed }; giveCurrency = 0; } else { if (giveCurrency >= 60000) { c.Amount = 60000; giveCurrency -= 60000; } else { c.Amount = giveCurrency; giveCurrency = 0; } } } c.GiveTo(seller); } seller.PlaySound(0x0037); //Gold dropping sound if (SupportsBulkOrders(seller)) { var bulkOrder = CreateBulkOrder(seller, false); if (bulkOrder is LargeBOD) { seller.SendGump(new LargeBODAcceptGump(seller, (LargeBOD)bulkOrder)); } else if (bulkOrder is SmallBOD) { seller.SendGump(new SmallBODAcceptGump(seller, (SmallBOD)bulkOrder)); } } return(true); }
public static void GenGauntlet_OnCommand( CommandEventArgs e ) { /* Begin healer room */ CreatePricedHealer( 5000, 387, 400 ); CreateTeleporter( 390, 407, 394, 405 ); BaseDoor healerDoor = CreateDoorSet( 393, 404, true, 0x44E ); healerDoor.Locked = true; healerDoor.KeyValue = Key.RandomValue(); if ( healerDoor.Link != null ) { healerDoor.Link.Locked = true; healerDoor.Link.KeyValue = Key.RandomValue(); } /* End healer room */ /* Begin supply room */ CreateMorphItem( 433, 371, 0x29F, 0x116, 3, 0x44E ); CreateMorphItem( 433, 372, 0x29F, 0x115, 3, 0x44E ); CreateVarietyDealer( 492, 369 ); for ( int x = 434; x <= 478; ++x ) { for ( int y = 371; y <= 372; ++y ) { Static item = new Static( 0x524 ); item.Hue = 1; item.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas ); } } /* End supply room */ /* Begin gauntlet cycle */ CreateTeleporter( 471, 428, 474, 428 ); CreateTeleporter( 462, 494, 462, 498 ); CreateTeleporter( 403, 502, 399, 506 ); CreateTeleporter( 357, 476, 356, 480 ); CreateTeleporter( 361, 433, 357, 434 ); GauntletSpawner sp1 = CreateSpawner( "DarknightCreeper", 491, 456, 473, 432, 417, 426, true, 473, 412, 39, 60 ); GauntletSpawner sp2 = CreateSpawner( "FleshRenderer", 482, 520, 468, 496, 426, 422, false, 448, 496, 56, 48 ); GauntletSpawner sp3 = CreateSpawner( "Impaler", 406, 538, 408, 504, 432, 430, false, 376, 504, 64, 48 ); GauntletSpawner sp4 = CreateSpawner( "ShadowKnight", 335, 512, 360, 478, 424, 439, false, 300, 478, 72, 64 ); GauntletSpawner sp5 = CreateSpawner( "AbysmalHorror", 326, 433, 360, 429, 416, 435, true, 300, 408, 60, 56 ); GauntletSpawner sp6 = CreateSpawner( "DemonKnight", 423, 430, 0, 0, 423, 430, true, 392, 392, 72, 96 ); sp1.Sequence = sp2; sp2.Sequence = sp3; sp3.Sequence = sp4; sp4.Sequence = sp5; sp5.Sequence = sp6; sp6.Sequence = sp1; sp1.State = GauntletSpawnerState.InProgress; /* End gauntlet cycle */ /* Begin exit gate */ ConfirmationMoongate gate = new ConfirmationMoongate(); gate.Dispellable = false; gate.Target = new Point3D( 2350, 1270, -85 ); gate.TargetMap = Map.Malas; gate.GumpWidth = 420; gate.GumpHeight = 280; gate.MessageColor = 0x7F00; gate.MessageNumber = 1062109; // You are about to exit Dungeon Doom. Do you wish to continue? gate.TitleColor = 0x7800; gate.TitleNumber = 1062108; // Please verify... gate.Hue = 0x44E; gate.MoveToWorld( new Point3D( 433, 326, 4 ), Map.Malas ); /* End exit gate */ }
public string PrepareTag() { StringBuilder sb = new StringBuilder(); DataTable dt = null; DataRow r = null; object hash = null; try { #region Биллийн формат файлыг унших string filename = string.Format("{0}\\Bill\\BillFormat.txt", _core.ApplicationPath); if (System.IO.File.Exists(filename)) { string s = System.IO.File.ReadAllText(filename); bool success = false; hash = JSON.JsonDecode(s, ref success); if (!success) { throw new Exception("Биллын формат файл буруу байна."); } } #endregion #region Толгойн custom мэдээллийг унших object hdr = Core.Core.JPathGet((Hashtable)hash, "header"); object ftr = Core.Core.JPathGet((Hashtable)hash, "footer"); if (hdr == null || ftr == null || !(hdr is ArrayList) || !(ftr is ArrayList)) { throw new Exception("Биллын формат файл буруу байна."); } ArrayList list = (ArrayList)hdr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion #region Биллийн толгой бэлдэх dt = _billdata.Tables["Totals"]; if (dt != null && dt.Rows.Count > 0) { r = dt.Rows[0]; string salesno = Static.ToStr(r["SALESNO"]); string cashiername = Static.ToStr(r["USERNAME"]); DateTime postdate = Static.ToDateTime(r["POSTDATE"]); string posno = Static.ToStr(r["POSNO"]); string posname = Static.ToStr(r["POSNAME"]); int shiftno = Static.ToInt(r["SHIFTNO"]); sb.Append(" TAG INFO\r\n"); sb.AppendFormat("{0,-16:yyyy/MM/dd HH:mm} {1,21}\r\n", DateTime.Now, salesno); //sb.AppendFormat("Cashier: {0,-17} POS: {1} ({2})\r\n", cashiername, posno, shiftno); } #endregion #region Биллийн барааны жагсаалт бэлдэх sb.AppendLine("========================================"); sb.AppendLine(" Customer Serial Series"); sb.AppendLine("----------------------------------------"); dt = _billdata.Tables["Tags"]; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { string custname = Static.ToStr(row["CUSTNAME"]); string tagno = Static.ToStr(row["SERIALNO"]); string tagframeno = Static.ToStr(row["TAGFRAMENO"]); sb.AppendFormat("{0,-25}{1,8}{2,7}\r\n" , custname , tagno , tagframeno ); } } sb.AppendLine("========================================"); #endregion #region Биллийн сүүл бэлдэх list = (ArrayList)ftr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion } catch (Exception ex) { _core.AlertShow("Билл Хэвлэх", ex.Message); } //System.IO.File.WriteAllText("c:\\bill2.txt", sb.ToString()); return(sb.ToString()); }
public BitmapObject(D2D.RenderTarget target, D2D.Bitmap bitmap, Origin origin, Mathe.RawPoint initPosision, bool enableLog = false) { Target = target; Bitmap = bitmap; Origin = origin; #if DEBUG _redBrush = new D2D.SolidColorBrush(target, new Mathe.RawColor4(1, 0, 0, 1)); #endif _x = (Static <float>)initPosision.X; _y = (Static <float>)initPosision.Y; _f = (Static <float>) 1; _r = (Static <float>) 0; _vx = (Static <float>) 1; _vy = (Static <float>) 1; // rects _w = (Static <float>)bitmap.Size.Width; _h = (Static <float>)bitmap.Size.Height; _inX = (Static <float>) 0; _inY = (Static <float>) 0; _inW = (Static <float>)bitmap.Size.Width; _inH = (Static <float>)bitmap.Size.Height; //origion switch (origin.Enum) { case Origin.OriginEnum.Free: _originOffsetX = (origin.X ?? 0) - initPosision.X; _originOffsetY = (origin.Y ?? 0) - initPosision.Y; break; case Origin.OriginEnum.BottomLeft: _originOffsetX = 0; _originOffsetY = (int)(Height); break; case Origin.OriginEnum.BottomCentre: _originOffsetX = (int)(Width / 2); _originOffsetY = (int)(Height); break; case Origin.OriginEnum.BottomRight: _originOffsetX = (int)(Width); _originOffsetY = (int)(Height); break; case Origin.OriginEnum.CentreLeft: _originOffsetX = 0; _originOffsetY = (int)(Height / 2); break; case Origin.OriginEnum.Centre: _originOffsetX = (int)(Width / 2); _originOffsetY = (int)(Height / 2); break; case Origin.OriginEnum.CentreRight: _originOffsetX = (int)(Width); _originOffsetY = (int)(Height / 2); break; case Origin.OriginEnum.TopLeft: _originOffsetX = 0; _originOffsetY = 0; break; case Origin.OriginEnum.TopCentre: _originOffsetX = (int)(Width / 2); _originOffsetY = 0; break; case Origin.OriginEnum.TopRight: _originOffsetX = (int)(Width); _originOffsetY = 0; break; } EnableLog = enableLog; }
public void PrintBillContents() { string result = null; try { foreach (DataRow r in _griddata.Rows) { bool selected = Static.ToBool(r["SELECTED"]); if (selected) { int loop = 1; string text = ""; string id = Static.ToStr(r["ID"]); if (id == "BILL") { text = PrepareBill(); result = _core.Printer.Open(); if (!string.IsNullOrEmpty(result)) { goto OnExit; } _core.Printer.Print(text); _core.Printer.Print("\r\n\r\n\r\n\r\n\r\n\x1Bi"); _core.Printer.Close(); } else if (id == "TAG") { text = PrepareTag(); result = _core.Printer.Open(); if (!string.IsNullOrEmpty(result)) { goto OnExit; } _core.Printer.Print(text); _core.Printer.Print("\r\n\r\n\r\n\r\n\r\n\x1Bi"); _core.Printer.Close(); } else { text = PrepareTicket(id, out loop); result = _core.LiftPrinter.Open(); if (!string.IsNullOrEmpty(result)) { goto OnExit; } for (int i = 0; i < loop; i++) { _core.LiftPrinter.Print(text); _core.Printer.Print("\r\n\r\n\r\n\r\n\r\n\x1Bi"); } _core.LiftPrinter.Close(); } } } } catch (Exception ex) { result = ex.ToString(); } OnExit: if (!string.IsNullOrEmpty(result)) { _core.AlertShow("Билл хэвлэх", result, 2); } }
public override void GenerateLoot() { AddLoot(LootPack.UltraRich, 4); AddLoot(LootPack.FilthyRich); ArrayList lootList = new ArrayList(); for (int i = 0; i < 6; i++) { Item item = new Static(2460 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 9; i++) { Item item = new Static(3786 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 4; i++) { Item item = new Static(3811 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 5; i++) { Item item = new Static(3892 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 2; i++) { Item item = new Static(3904 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 7; i++) { Item item = new Static(4650 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 7; i++) { Item item = new Static(4650 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 2; i++) { Item item = new Static(5052 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 2; i++) { Item item = new Static(5057 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 3; i++) { Item item = new Static(5064 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 3; i++) { Item item = new Static(5071 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 3; i++) { Item item = new Static(5079 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 3; i++) { Item item = new Static(5086 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 6; i++) { Item item = new Static(5093 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 4; i++) { Item item = new Static(5160 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 1; i++) { Item item = new Static(5384 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 1; i++) { Item item = new Static(5402 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 1; i++) { Item item = new Static(5396 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 14; i++) { Item item = new Static(6657 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < 30; i++) { Item item = new Static(6913 + i); item.Movable = true; lootList.Add(item); } for (int i = 0; i < lootList.Count; i++) { if (Utility.Random(100) >= 51) { PackItem((Item)(lootList[i])); } } }
protected void TestInstructionInfo(int bitness, string hexBytes, Code code, DecoderOptions options, int lineNo, InstructionInfoTestCase testCase) { var codeBytes = HexUtils.ToByteArray(hexBytes); Instruction instruction; if (testCase.IsSpecial) { if (bitness == 16 && code == Code.Popw_CS && hexBytes == "0F") { instruction = default; instruction.Code = Code.Popw_CS; instruction.Op0Kind = OpKind.Register; instruction.Op0Register = Register.CS; instruction.CodeSize = CodeSize.Code16; instruction.Length = 1; } else if (code <= Code.DeclareQword) { instruction = default; instruction.Code = code; instruction.DeclareDataCount = 1; Assert.Equal(64, bitness); instruction.CodeSize = CodeSize.Code64; switch (code) { case Code.DeclareByte: Assert.Equal("66", hexBytes); instruction.SetDeclareByteValue(0, 0x66); break; case Code.DeclareWord: Assert.Equal("6644", hexBytes); instruction.SetDeclareWordValue(0, 0x4466); break; case Code.DeclareDword: Assert.Equal("664422EE", hexBytes); instruction.SetDeclareDwordValue(0, 0xEE224466); break; case Code.DeclareQword: Assert.Equal("664422EE12345678", hexBytes); instruction.SetDeclareQwordValue(0, 0x78563412EE224466); break; default: throw new InvalidOperationException(); } } else { var decoder = CreateDecoder(bitness, codeBytes, options); instruction = decoder.Decode(); if (codeBytes.Length > 1 && codeBytes[0] == 0x9B && instruction.Length == 1) { instruction = decoder.Decode(); instruction.Code = instruction.Code switch { Code.Fnstenv_m14byte => Code.Fstenv_m14byte, Code.Fnstenv_m28byte => Code.Fstenv_m28byte, Code.Fnstcw_m2byte => Code.Fstcw_m2byte, Code.Fneni => Code.Feni, Code.Fndisi => Code.Fdisi, Code.Fnclex => Code.Fclex, Code.Fninit => Code.Finit, Code.Fnsetpm => Code.Fsetpm, Code.Fnsave_m94byte => Code.Fsave_m94byte, Code.Fnsave_m108byte => Code.Fsave_m108byte, Code.Fnstsw_m2byte => Code.Fstsw_m2byte, Code.Fnstsw_AX => Code.Fstsw_AX, Code.Fnstdw_AX => Code.Fstdw_AX, Code.Fnstsg_AX => Code.Fstsg_AX, _ => throw new InvalidOperationException(), }; } else { throw new InvalidOperationException(); } } } else { var decoder = CreateDecoder(bitness, codeBytes, options); instruction = decoder.Decode(); } Assert.Equal(code, instruction.Code); Assert.Equal(testCase.StackPointerIncrement, instruction.StackPointerIncrement); var info = new InstructionInfoFactory().GetInfo(instruction); Assert.Equal(testCase.Encoding, info.Encoding); Assert.Equal(testCase.CpuidFeatures, info.CpuidFeatures); Assert.Equal(testCase.RflagsRead, info.RflagsRead); Assert.Equal(testCase.RflagsUndefined, info.RflagsUndefined); Assert.Equal(testCase.RflagsWritten, info.RflagsWritten); Assert.Equal(testCase.RflagsCleared, info.RflagsCleared); Assert.Equal(testCase.RflagsSet, info.RflagsSet); Assert.Equal(testCase.IsPrivileged, info.IsPrivileged); Assert.Equal(testCase.IsStackInstruction, info.IsStackInstruction); Assert.Equal(testCase.IsSaveRestoreInstruction, info.IsSaveRestoreInstruction); Assert.Equal(testCase.FlowControl, info.FlowControl); Assert.Equal(testCase.Op0Access, info.Op0Access); Assert.Equal(testCase.Op1Access, info.Op1Access); Assert.Equal(testCase.Op2Access, info.Op2Access); Assert.Equal(testCase.Op3Access, info.Op3Access); Assert.Equal(testCase.Op4Access, info.Op4Access); Assert.Equal( new HashSet <UsedMemory>(testCase.UsedMemory, UsedMemoryEqualityComparer.Instance), new HashSet <UsedMemory>(info.GetUsedMemory(), UsedMemoryEqualityComparer.Instance)); Assert.Equal( new HashSet <UsedRegister>(GetUsedRegisters(testCase.UsedRegisters), UsedRegisterEqualityComparer.Instance), new HashSet <UsedRegister>(GetUsedRegisters(info.GetUsedRegisters()), UsedRegisterEqualityComparer.Instance)); Static.Assert(IcedConstants.MaxOpCount == 5 ? 0 : -1); Debug.Assert(instruction.OpCount <= IcedConstants.MaxOpCount); for (int i = 0; i < instruction.OpCount; i++) { switch (i) { case 0: Assert.Equal(testCase.Op0Access, info.GetOpAccess(i)); break; case 1: Assert.Equal(testCase.Op1Access, info.GetOpAccess(i)); break; case 2: Assert.Equal(testCase.Op2Access, info.GetOpAccess(i)); break; case 3: Assert.Equal(testCase.Op3Access, info.GetOpAccess(i)); break; case 4: Assert.Equal(testCase.Op4Access, info.GetOpAccess(i)); break; default: throw new InvalidOperationException(); } } for (int i = instruction.OpCount; i < IcedConstants.MaxOpCount; i++) { Assert.Equal(OpAccess.None, info.GetOpAccess(i)); } Assert.Equal(RflagsBits.None, info.RflagsWritten & (info.RflagsCleared | info.RflagsSet | info.RflagsUndefined)); Assert.Equal(RflagsBits.None, info.RflagsCleared & (info.RflagsWritten | info.RflagsSet | info.RflagsUndefined)); Assert.Equal(RflagsBits.None, info.RflagsSet & (info.RflagsWritten | info.RflagsCleared | info.RflagsUndefined)); Assert.Equal(RflagsBits.None, info.RflagsUndefined & (info.RflagsWritten | info.RflagsCleared | info.RflagsSet)); Assert.Equal(info.RflagsWritten | info.RflagsCleared | info.RflagsSet | info.RflagsUndefined, info.RflagsModified); var info2 = new InstructionInfoFactory().GetInfo(instruction, InstructionInfoOptions.None); CheckEqual(ref info, ref info2, hasRegs2: true, hasMem2: true); info2 = new InstructionInfoFactory().GetInfo(instruction, InstructionInfoOptions.NoMemoryUsage); CheckEqual(ref info, ref info2, hasRegs2: true, hasMem2: false); info2 = new InstructionInfoFactory().GetInfo(instruction, InstructionInfoOptions.NoRegisterUsage); CheckEqual(ref info, ref info2, hasRegs2: false, hasMem2: true); info2 = new InstructionInfoFactory().GetInfo(instruction, InstructionInfoOptions.NoRegisterUsage | InstructionInfoOptions.NoMemoryUsage); CheckEqual(ref info, ref info2, hasRegs2: false, hasMem2: false); Assert.Equal(info.Encoding, instruction.Code.Encoding()); #if ENCODER && OPCODE_INFO Assert.Equal(code.ToOpCode().Encoding, instruction.Code.Encoding()); #endif Assert.Equal(info.CpuidFeatures, instruction.Code.CpuidFeatures()); Assert.Equal(info.FlowControl, instruction.Code.FlowControl()); Assert.Equal(info.IsPrivileged, instruction.Code.IsPrivileged()); Assert.Equal(info.IsStackInstruction, instruction.Code.IsStackInstruction()); Assert.Equal(info.IsSaveRestoreInstruction, instruction.Code.IsSaveRestoreInstruction()); Assert.Equal(info.Encoding, instruction.Encoding); Assert.Equal(info.CpuidFeatures, instruction.CpuidFeatures); Assert.Equal(info.FlowControl, instruction.FlowControl); Assert.Equal(info.IsPrivileged, instruction.IsPrivileged); Assert.Equal(info.IsStackInstruction, instruction.IsStackInstruction); Assert.Equal(info.IsSaveRestoreInstruction, instruction.IsSaveRestoreInstruction); Assert.Equal(info.RflagsRead, instruction.RflagsRead); Assert.Equal(info.RflagsWritten, instruction.RflagsWritten); Assert.Equal(info.RflagsCleared, instruction.RflagsCleared); Assert.Equal(info.RflagsSet, instruction.RflagsSet); Assert.Equal(info.RflagsUndefined, instruction.RflagsUndefined); Assert.Equal(info.RflagsModified, instruction.RflagsModified); }
public void Write1(Block[] block) { if(!m_OceanWrited) { StaMulW.BaseStream.Position = 0; m_OceanOffset = (uint)StaMulW.BaseStream.Position; m_OceanLength = (uint)(7 * 64); Static[] ocean = new Static[64]; for (int k = 0; k < 64; ++k) { ocean[k].m_ID = (ushort)rand.Next(0x1797, 0x179D); ocean[k].m_Hue = 0; ocean[k].m_X = (byte)(k % 8); ocean[k].m_Y = (byte)(k / 8); ocean[k].m_Z = -45; StaMulW.Write(ocean[k].m_ID); StaMulW.Write(ocean[k].m_X); StaMulW.Write(ocean[k].m_Y); StaMulW.Write(ocean[k].m_Z); StaMulW.Write(ocean[k].m_Hue); } m_OceanWrited = true; } for (int i = 0; i < block.Length; ++i) { MapMulW.Write(block[i].m_Header); for (int k = 0; k < 64; ++k) { MapMulW.Write(block[i].m_Tiles[k].m_ID); MapMulW.Write(block[i].m_Tiles[k].m_Z); } if (block[i].m_Statics == null || block[i].m_Statics.Length == 0) { block[i].m_Offset = 0xFFFFFFFF; block[i].m_Length = 0; } else if (block[i].m_Ocean) { block[i].m_Offset = ((m_OceanOffset != 0xFFFFFFFF) ? m_OceanOffset : (m_OceanOffset = (uint)StaMulW.BaseStream.Position)); block[i].m_Length = ((m_OceanLength != 0) ? m_OceanLength : (m_OceanLength = (uint)(7 * 64))); } else { block[i].m_Offset = (uint)StaMulW.BaseStream.Position; block[i].m_Length = (uint)(7 * block[i].m_Statics.Length); } StaIdxW.Write(block[i].m_Offset); StaIdxW.Write(block[i].m_Length); StaIdxW.Write(block[i].m_Unknown); if (block[i].m_Offset == 0xFFFFFFFF || block[i].m_Length == 0) continue; if (block[i].m_Ocean && m_OceanWrited) continue; for (int k = 0; k < block[i].m_Statics.Length; ++k) { StaMulW.Write(block[i].m_Statics[k].m_ID); StaMulW.Write(block[i].m_Statics[k].m_X); StaMulW.Write(block[i].m_Statics[k].m_Y); StaMulW.Write(block[i].m_Statics[k].m_Z); StaMulW.Write(block[i].m_Statics[k].m_Hue); } if (block[i].m_Ocean && !m_OceanWrited) m_OceanWrited = true; } //m_OceanWrited = false; }
public static void GenGauntlet_OnCommand(CommandEventArgs e) { /* Begin healer room */ CreatePricedHealer(5000, 387, 400); CreateTeleporter(390, 407, 394, 405); BaseDoor healerDoor = CreateDoorSet(393, 404, true, 0x44E); healerDoor.Locked = true; healerDoor.KeyValue = Key.RandomValue(); if (healerDoor.Link != null) { healerDoor.Link.Locked = true; healerDoor.Link.KeyValue = Key.RandomValue(); } /* End healer room */ /* Begin supply room */ CreateMorphItem(433, 371, 0x29F, 0x116, 3, 0x44E); CreateMorphItem(433, 372, 0x29F, 0x115, 3, 0x44E); CreateVarietyDealer(492, 369); for (int x = 434; x <= 478; ++x) { for (int y = 371; y <= 372; ++y) { Static item = new Static(0x524); item.Hue = 1; item.MoveToWorld(new Point3D(x, y, -1), Map.Malas); } } /* End supply room */ /* Begin gauntlet cycle */ CreateTeleporter(471, 428, 474, 428); CreateTeleporter(462, 494, 462, 498); CreateTeleporter(403, 502, 399, 506); CreateTeleporter(357, 476, 356, 480); CreateTeleporter(361, 433, 357, 434); GauntletSpawner sp1 = CreateSpawner("DarknightCreeper", 491, 456, 473, 432, 417, 426, true, 473, 412, 39, 60); GauntletSpawner sp2 = CreateSpawner("FleshRenderer", 482, 520, 468, 496, 426, 422, false, 448, 496, 56, 48); GauntletSpawner sp3 = CreateSpawner("Impaler", 406, 538, 408, 504, 432, 430, false, 376, 504, 64, 48); GauntletSpawner sp4 = CreateSpawner("ShadowKnight", 335, 512, 360, 478, 424, 439, false, 300, 478, 72, 64); GauntletSpawner sp5 = CreateSpawner("AbysmalHorror", 326, 433, 360, 429, 416, 435, true, 300, 408, 60, 56); GauntletSpawner sp6 = CreateSpawner("DemonKnight", 423, 430, 0, 0, 423, 430, true, 392, 392, 72, 96); sp1.Sequence = sp2; sp2.Sequence = sp3; sp3.Sequence = sp4; sp4.Sequence = sp5; sp5.Sequence = sp6; sp6.Sequence = sp1; sp1.State = GauntletSpawnerState.InProgress; /* End gauntlet cycle */ /* Begin exit gate */ ConfirmationMoongate gate = new ConfirmationMoongate(); gate.Dispellable = false; gate.Target = new Point3D(2350, 1270, -85); gate.TargetMap = Map.Malas; gate.GumpWidth = 420; gate.GumpHeight = 280; gate.MessageColor = 0x7F00; gate.MessageNumber = 1062109; // You are about to exit Dungeon Doom. Do you wish to continue? gate.TitleColor = 0x7800; gate.TitleNumber = 1062108; // Please verify... gate.Hue = 0x44E; gate.MoveToWorld(new Point3D(433, 326, 4), Map.Malas); /* End exit gate */ }
private static void BuildTeleporters(string elementName, XmlElement root, ref int unique) { var name = root.GetElementsByTagName(elementName); for (var index = 0; index < name.Count; index++) { var region = (XmlElement)name[index]; var list = new Dictionary <WorldLocation, WorldLocation>(); Map locMap = null; Map teleMap = null; var tiles = region.GetElementsByTagName("tiles"); for (var i = 0; i < tiles.Count; i++) { var tile = (XmlElement)tiles[i]; Point3D from = Point3D.Parse(Utility.GetAttribute(tile, "from", "(0, 0, 0)")); Map fromMap = Map.Parse(Utility.GetAttribute(tile, "frommap", null)); Point3D to = Point3D.Parse(Utility.GetAttribute(tile, "to", "(0, 0, 0)")); Map toMap = Map.Parse(Utility.GetAttribute(tile, "tomap", null)); int id = Utility.ToInt32(Utility.GetAttribute(tile, "ItemID", "-1")); int hue = Utility.ToInt32(Utility.GetAttribute(tile, "Hue", "-1")); if (fromMap == null) { throw new ArgumentException($"Map parsed as null: {from}"); } if (toMap == null) { throw new ArgumentException($"Map parsed as null: {to}"); } if (Siege.SiegeShard && (fromMap == Map.Trammel || toMap == Map.Trammel)) { continue; } list.Add(new WorldLocation(from, fromMap), new WorldLocation(to, toMap)); if (list.Count == 1) { locMap = fromMap; teleMap = toMap; } if (id > -1) { bool any = false; foreach (var s in fromMap.FindItems <Static>(from, 0)) { if (s.ItemID == id) { any = true; break; } } if (!any) { var st = new Static(id); if (hue > -1) { st.Hue = hue; } st.MoveToWorld(from, fromMap); } } } if (list.Count > 0) { Rectangle3D[] recs = new Rectangle3D[list.Count]; var i = 0; foreach (var kvp in list) { recs[i++] = new Rectangle3D(kvp.Key.Location.X, kvp.Key.Location.Y, kvp.Key.Location.Z - 5, 1, 1, 10); } TeleportRegion teleRegion; if (!Siege.SiegeShard && locMap != null && locMap.Rules != MapRules.FeluccaRules && teleMap.Rules == MapRules.FeluccaRules) { teleRegion = new TeleportRegionPVPWarning($"Teleport Region {unique.ToString()}", locMap, recs, list); } else { teleRegion = new TeleportRegion($"Teleport Region {unique.ToString()}", locMap, recs, list); } teleRegion.Register(); unique++; } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); bool haveproximityrange = false; bool hasnewobjectinfo = false; int tmpSpawnListSize = 0; ArrayList tmpSubGroup = null; ArrayList tmpSequentialResetTime = null; ArrayList tmpSequentialResetTo = null; ArrayList tmpKillsNeeded = null; ArrayList tmpRequireSurface = null; ArrayList tmpRestrictKillsToSubgroup = null; ArrayList tmpClearOnAdvance = null; ArrayList tmpMinDelay = null; ArrayList tmpMaxDelay = null; ArrayList tmpNextSpawn = null; ArrayList tmpDisableSpawn = null; ArrayList tmpPackRange = null; ArrayList tmpSpawnsPer = null; switch( version ) { case 30: { m_AllowNPCTriggering = reader.ReadBool(); goto case 29; } case 29: { tmpSpawnListSize = reader.ReadInt(); tmpSpawnsPer = new ArrayList( tmpSpawnListSize ); for( int i = 0; i < tmpSpawnListSize; ++i ) { int spawnsper = reader.ReadInt(); tmpSpawnsPer.Add( spawnsper ); } goto case 28; } case 28: { if( version < 29 ) tmpSpawnListSize = reader.ReadInt(); tmpPackRange = new ArrayList( tmpSpawnListSize ); for( int i = 0; i < tmpSpawnListSize; ++i ) { int packrange = reader.ReadInt(); tmpPackRange.Add( packrange ); } goto case 27; } case 27: { if( version < 28 ) tmpSpawnListSize = reader.ReadInt(); tmpDisableSpawn = new ArrayList( tmpSpawnListSize ); for( int i = 0; i < tmpSpawnListSize; ++i ) { bool disablespawn = reader.ReadBool(); tmpDisableSpawn.Add( disablespawn ); } goto case 26; } case 26: { m_SpawnOnTrigger = reader.ReadBool(); m_FirstModified = reader.ReadDateTime(); m_LastModified = reader.ReadDateTime(); goto case 25; } case 25: { goto case 24; } case 24: { if( version < 27 ) tmpSpawnListSize = reader.ReadInt(); tmpRestrictKillsToSubgroup = new ArrayList( tmpSpawnListSize ); tmpClearOnAdvance = new ArrayList( tmpSpawnListSize ); tmpMinDelay = new ArrayList( tmpSpawnListSize ); tmpMaxDelay = new ArrayList( tmpSpawnListSize ); tmpNextSpawn = new ArrayList( tmpSpawnListSize ); for( int i = 0; i < tmpSpawnListSize; ++i ) { bool restrictkills = reader.ReadBool(); bool clearadvance = reader.ReadBool(); double mind = reader.ReadDouble(); double maxd = reader.ReadDouble(); DateTime nextspawn = reader.ReadDeltaTime(); tmpRestrictKillsToSubgroup.Add( restrictkills ); tmpClearOnAdvance.Add( clearadvance ); tmpMinDelay.Add( mind ); tmpMaxDelay.Add( maxd ); tmpNextSpawn.Add( nextspawn ); } bool hasitems = reader.ReadBool(); if( hasitems ) { m_ShowBoundsItems = reader.ReadItemList(); } goto case 23; } case 23: { IsInactivated = reader.ReadBool(); SmartSpawning = reader.ReadBool(); goto case 22; } case 22: { SkillTrigger = reader.ReadString(); // note this will also register the skill m_skill_that_triggered = (SkillName)reader.ReadInt(); m_FreeRun = reader.ReadBool(); m_mob_who_triggered = reader.ReadMobile(); goto case 21; } case 21: { m_DespawnTime = reader.ReadTimeSpan(); goto case 20; } case 20: { if( version < 24 ) tmpSpawnListSize = reader.ReadInt(); tmpRequireSurface = new ArrayList( tmpSpawnListSize ); for( int i = 0; i < tmpSpawnListSize; ++i ) { bool requiresurface = reader.ReadBool(); tmpRequireSurface.Add( requiresurface ); } goto case 19; } case 19: { m_ConfigFile = reader.ReadString(); m_OnHold = reader.ReadBool(); m_HoldSequence = reader.ReadBool(); m_FirstModifiedBy = reader.ReadString(); m_LastModifiedBy = reader.ReadString(); // deserialize the keyword tag list int tagcount = reader.ReadInt(); m_KeywordTagList = new ArrayList( tagcount ); for( int i = 0; i < tagcount; i++ ) { BaseXmlSpawner.KeywordTag tag = new BaseXmlSpawner.KeywordTag( null, this ); tag.Deserialize( reader ); } goto case 18; } case 18: { m_AllowGhostTriggering = reader.ReadBool(); goto case 17; } case 17: { if( version < 25 ) { // the textentrybooks are deleted on deserialization so no need to track them reader.ReadItem(); } goto case 16; } case 16: { hasnewobjectinfo = true; m_SequentialSpawning = reader.ReadInt(); TimeSpan seqdelay = reader.ReadTimeSpan(); m_SeqEnd = DateTime.Now + seqdelay; if( version < 20 ) { tmpSpawnListSize = reader.ReadInt(); } tmpSubGroup = new ArrayList( tmpSpawnListSize ); tmpSequentialResetTime = new ArrayList( tmpSpawnListSize ); tmpSequentialResetTo = new ArrayList( tmpSpawnListSize ); tmpKillsNeeded = new ArrayList( tmpSpawnListSize ); for( int i = 0; i < tmpSpawnListSize; ++i ) { int subgroup = reader.ReadInt(); double resettime = reader.ReadDouble(); int resetto = reader.ReadInt(); int killsneeded = reader.ReadInt(); tmpSubGroup.Add( subgroup ); tmpSequentialResetTime.Add( resettime ); tmpSequentialResetTo.Add( resetto ); tmpKillsNeeded.Add( killsneeded ); } m_RegionName = reader.ReadString(); // 2004.02.08 :: Omega Red goto case 15; } case 15: { m_ExternalTriggering = reader.ReadBool(); m_ExternalTrigger = reader.ReadBool(); goto case 14; } case 14: { m_NoItemTriggerName = reader.ReadString(); goto case 13; } case 13: { m_GumpState = reader.ReadString(); goto case 12; } case 12: { int todtype = reader.ReadInt(); switch( todtype ) { case (int)TODModeType.Gametime: m_TODMode = TODModeType.Gametime; break; case (int)TODModeType.Realtime: m_TODMode = TODModeType.Realtime; break; } goto case 11; } case 11: { m_KillReset = reader.ReadInt(); m_skipped = reader.ReadBool(); m_spawncheck = reader.ReadInt(); goto case 10; } case 10: { m_SetPropertyItem = reader.ReadItem(); goto case 9; } case 9: { m_TriggerProbability = reader.ReadDouble(); goto case 8; } case 8: { m_MobPropertyName = reader.ReadString(); m_MobTriggerName = reader.ReadString(); m_PlayerPropertyName = reader.ReadString(); goto case 7; } case 7: { m_SpeechTrigger = reader.ReadString(); goto case 6; } case 6: { m_ItemTriggerName = reader.ReadString(); goto case 5; } case 5: { m_ProximityTriggerMessage = reader.ReadString(); m_ObjectPropertyItem = reader.ReadItem(); m_ObjectPropertyName = reader.ReadString(); m_killcount = reader.ReadInt(); goto case 4; } case 4: { haveproximityrange = true; m_ProximityRange = reader.ReadInt(); m_ProximityTriggerSound = reader.ReadInt(); m_proximityActivated = reader.ReadBool(); m_durActivated = reader.ReadBool(); m_refractActivated = reader.ReadBool(); m_StackAmount = reader.ReadInt(); m_TODStart = reader.ReadTimeSpan(); m_TODEnd = reader.ReadTimeSpan(); m_MinRefractory = reader.ReadTimeSpan(); m_MaxRefractory = reader.ReadTimeSpan(); if( m_refractActivated == true ) { TimeSpan delay = reader.ReadTimeSpan(); DoTimer3( delay ); } if( m_durActivated == true ) { TimeSpan delay = reader.ReadTimeSpan(); DoTimer2( delay ); } goto case 3; } case 3: { m_ShowContainerStatic = reader.ReadItem() as Static; goto case 2; } case 2: { m_Duration = reader.ReadTimeSpan(); goto case 1; } case 1: { m_UniqueId = reader.ReadString(); m_HomeRangeIsRelative = reader.ReadBool(); goto case 0; } case 0: { m_Name = reader.ReadString(); // backward compatibility with old name storage if( m_Name != null && m_Name != String.Empty ) Name = m_Name; m_X = reader.ReadInt(); m_Y = reader.ReadInt(); m_Width = reader.ReadInt(); m_Height = reader.ReadInt(); if( m_Width == m_Height ) m_SpawnRange = m_Width / 2; else m_SpawnRange = -1; if( !haveproximityrange ) { m_ProximityRange = -1; } m_WayPoint = reader.ReadItem() as WayPoint; m_Group = reader.ReadBool(); m_MinDelay = reader.ReadTimeSpan(); m_MaxDelay = reader.ReadTimeSpan(); m_Count = reader.ReadInt(); m_Team = reader.ReadInt(); m_HomeRange = reader.ReadInt(); m_Running = reader.ReadBool(); if( m_Running == true ) { TimeSpan delay = reader.ReadTimeSpan(); DoTimer( delay ); } // Read in the size of the spawn object list int SpawnListSize = reader.ReadInt(); m_SpawnObjects = new ArrayList( SpawnListSize ); for( int i = 0; i < SpawnListSize; ++i ) { string TypeName = reader.ReadString(); int TypeMaxCount = reader.ReadInt(); SpawnObject TheSpawnObject = new SpawnObject( TypeName, TypeMaxCount ); m_SpawnObjects.Add( TheSpawnObject ); string typeName = BaseXmlSpawner.ParseObjectType( TypeName ); // does it have a substitution that might change its validity? // if so then let it go if( typeName == null || ((SpawnerType.GetType( typeName ) == null) && (!BaseXmlSpawner.IsTypeOrItemKeyword( typeName ) && typeName.IndexOf( '{' ) == -1 && !typeName.StartsWith( "*" ) && !typeName.StartsWith( "#" ))) ) { if( m_WarnTimer == null ) m_WarnTimer = new WarnTimer2(); m_WarnTimer.Add( Location, Map, TypeName ); this.status_str = "invalid type: " + typeName; } // Read in the number of spawns already int SpawnedCount = reader.ReadInt(); TheSpawnObject.SpawnedObjects = new ArrayList( SpawnedCount ); for( int x = 0; x < SpawnedCount; ++x ) { int serial = reader.ReadInt(); if( serial < -1 ) { // minusone is reserved for unknown types by default // minustwo on is used for referencing keyword tags int tagserial = -1 * (serial + 2); // get the tag with that serial and add it BaseXmlSpawner.KeywordTag t = BaseXmlSpawner.GetFromTagList( this, tagserial ); if( t != null ) { TheSpawnObject.SpawnedObjects.Add( t ); } } else { IEntity e = World.FindEntity( serial ); if( e != null ) TheSpawnObject.SpawnedObjects.Add( e ); } } } // now have to reintegrate the later version spawnobject information into the earlier version desered objects if( hasnewobjectinfo && tmpSpawnListSize == SpawnListSize ) { for( int i = 0; i < SpawnListSize; ++i ) { SpawnObject so = (SpawnObject)m_SpawnObjects[i]; so.SubGroup = (int)tmpSubGroup[i]; so.SequentialResetTime = (double)tmpSequentialResetTime[i]; so.SequentialResetTo = (int)tmpSequentialResetTo[i]; so.KillsNeeded = (int)tmpKillsNeeded[i]; if( version > 19 ) so.RequireSurface = (bool)tmpRequireSurface[i]; bool restrictkills = false; bool clearadvance = true; double mind = -1; double maxd = -1; DateTime nextspawn = DateTime.MinValue; if( version > 23 ) { restrictkills = (bool)tmpRestrictKillsToSubgroup[i]; clearadvance = (bool)tmpClearOnAdvance[i]; mind = (double)tmpMinDelay[i]; maxd = (double)tmpMaxDelay[i]; nextspawn = (DateTime)tmpNextSpawn[i]; } so.RestrictKillsToSubgroup = restrictkills; so.ClearOnAdvance = clearadvance; so.MinDelay = mind; so.MaxDelay = maxd; so.NextSpawn = nextspawn; bool disablespawn = false; if( version > 26 ) { disablespawn = (bool)tmpDisableSpawn[i]; } so.Disabled = disablespawn; int packrange = -1; if( version > 27 ) { packrange = (int)tmpPackRange[i]; } so.PackRange = packrange; int spawnsper = 1; if( version > 28 ) { spawnsper = (int)tmpSpawnsPer[i]; } so.SpawnsPerTick = spawnsper; } } break; } } }
public OphidianMatriarch() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 ) { LastTimeSpoken = DateTime.Now; Name = "an ophidian matriarch"; Body = 87; SpeechHue = 2129; BaseSoundID = 644; SetStr( 416, 505 ); SetDex( 96, 115 ); SetInt( 366, 455 ); SetHits( 250, 303 ); SetDamage( 11, 13 ); SetSkill( SkillName.EvalInt, 90.1, 100.0 ); SetSkill( SkillName.Magery, 90.1, 100.0 ); SetSkill( SkillName.Meditation, 5.4, 25.0 ); SetSkill( SkillName.MagicResist, 90.1, 100.0 ); SetSkill( SkillName.Tactics, 50.1, 70.0 ); SetSkill( SkillName.Wrestling, 60.1, 80.0 ); Fame = 16000; Karma = -16000; VirtualArmor = 50; Item item = null; switch( Utility.Random(2500) ) { case 0: PackItem( item = new Static(0x9DC) ); break; case 1: PackItem( item = new Static(0x9DD) ); break; case 2: PackItem( item = new Static(0x9DF) ); break; case 3: PackItem( item = new Static(0x9E6) ); break; case 4: PackItem( item = new Static(0x9E7) ); break; case 5: PackItem( item = new Static(0x9E8) ); break; } if (item != null) item.Movable = true; PackPotion(); PackJewel( 0.02 ); PackGem(); PackItem( new Arrow( Utility.RandomMinMax( 1, 10 ) ) ); PackGold( 300, 450 ); PackScroll( 3, 7 ); PackScroll( 3, 7 ); PackScroll( 3, 7 ); switch ( Utility.Random( 2 ) ) { case 0: PackWeapon( 0, 5 ); break; case 1: PackArmor( 0, 5 ); break; } switch ( Utility.Random( 3 ) ) { case 0: PackWeapon( 0, 5 ); break; case 1: PackArmor( 0, 5 ); break; } switch ( Utility.Random( 10 ) ) { case 0: PackWeapon( 1, 5 ); break; case 1: PackArmor( 1, 5 ); break; } switch ( Utility.Random( 25 ) ) { case 0: PackWeapon( 3, 5 ); break; case 1: PackArmor( 3, 5 ); break; } if ( 0.05 > Utility.RandomDouble() ) PackReg( 250 ); if ( 0.01 > Utility.RandomDouble() ) PackItem( new IDWand() ); }
private void ParseFileForStatics(BinaryReader br, Dictionary<string, staticOverride> OverrideList, bool activators, bool includemisc, Dictionary<string, bool> IgnoreList) { int DEBUG_statics = 0; int DEBUG_ignored = 0; //Look for any scripts that might be disabling activators if (activators) { ParseFileForDisableScripts(br, OverrideList); //Rest file position br.BaseStream.Position = 0; } string s = ""; while (br.BaseStream.Position < br.BaseStream.Length) { s = ReadString(br); int size = br.ReadInt32(); br.BaseStream.Position += 8; if (s == "STAT" || s == "ACTI" || s == "DOOR" || s == "CONT" || s == "LIGH") { int read = 0; bool activator = s == "ACTI"; bool misc = s == "DOOR" || s == "CONT" || s == "LIGH"; string name = null; string model = null; string script = null; while (read < size) { s = ReadString(br); int size2 = br.ReadInt32(); read += size2 + 8; switch (s) { case "NAME": name = ReadCString(br).ToLower(Statics.Culture); break; case "MODL": model = ReadCString(br).ToLower(Statics.Culture); break; case "SCRI": script = ReadCString(br).ToLower(Statics.Culture); break; default: br.BaseStream.Position += size2; break; } } if (name != null && model != null && model.Trim () != null) { //Named exceptions if (IgnoreList != null && IgnoreList.ContainsKey(name)) { if (!IgnoreList[name]) { StaticsList[name] = new Static(name, model); if (OverrideList != null && OverrideList.ContainsKey(model) && OverrideList[model].Ignore) { OverrideList[model] = new staticOverride(OverrideList[model], true); if (DEBUG) { DEBUG_statics++; continue; } } } if (DEBUG) DEBUG_ignored++; continue; } //NoScript override if (script != null && OverrideList != null && OverrideList.ContainsKey(model) && OverrideList[model].NoScript) { script = null; } //Special exceptions if (name == "chargen boat" || name == "chargen_plank") { if (DEBUG) DEBUG_ignored++; continue; } //Special model exceptions if (model == "f\\active_blight_large.nif") { if (OverrideList != null && !OverrideList.ContainsKey(model)) { if (DEBUG) DEBUG_ignored++; continue; } } if ((misc && !includemisc) || activator && !activators) { if (OverrideList != null && OverrideList.ContainsKey(model) && !OverrideList[model].Ignore) { if (script != null && DisableScripts != null && DisableScripts.ContainsKey(script) && DisableScripts[script] == true) { if (DEBUG) DEBUG_ignored++; continue; } StaticsList[name] = new Static(name, model); if (DEBUG) DEBUG_statics++; } } else { if (OverrideList == null || !OverrideList.ContainsKey(model) || !OverrideList[model].Ignore) { if (script != null && DisableScripts != null && DisableScripts.ContainsKey(script) && DisableScripts[script] == true) { if (DEBUG) DEBUG_ignored++; continue; } StaticsList[name] = new Static(name, model); if (DEBUG) DEBUG_statics++; } } } } else br.BaseStream.Position += size; } if (DEBUG) allWarnings.Add("Static definitions: " + DEBUG_statics + "; Ignored definitions: " + DEBUG_ignored); }
protected override void OnTarget(Mobile from, object targeted) { IPoint3D target = targeted as IPoint3D; if (target == null) return; Map map = from.Map; if (map == null) return; Point3D location = new Point3D(target); if (target is StaticTarget) location.Z -= TileData.ItemTable[((StaticTarget)target).ItemID & 0x3FFF].CalcHeight; Item newItem = new Static(m_ItemID); newItem.MoveToWorld(location, from.Map); from.Target = new CreateItemTarget(m_ItemID, m_Search); }
public static void GenerateQuestContent() { var map = Siege.SiegeShard ? Map.Felucca : Map.Trammel; var addon = new KhaldunDecorationAddon(); addon.MoveToWorld(new Point3D(6232, 2887, -1), map); // Britain var door = new TrapDoor("boreas", new Point3D(6242, 2892, 17), map); var book = new MysteriousBook(door); var dust = new DustPile(door); var teleporter = new Teleporter(new Point3D(1369, 1465, 10), map); door.MoveToWorld(new Point3D(1369, 1465, 10), map); book.MoveToWorld(new Point3D(6240, 2885, 8), map); dust.MoveToWorld(new Point3D(6256, 2889, 13), map); teleporter.MoveToWorld(new Point3D(6242, 2892, 17), map); new GumshoeBottles().MoveToWorld(new Point3D(6154, 2901, 6), map); new GumshoeBottles().MoveToWorld(new Point3D(6154, 2902, 6), map); new GumshoeDeed().MoveToWorld(new Point3D(6161, 2901, 6), map); new GumshoeRope().MoveToWorld(new Point3D(6163, 2896, 0), map); new GumshoeRope().MoveToWorld(new Point3D(6163, 2896, 1), map); new GumshoeMap().MoveToWorld(new Point3D(6166, 2895, 6), map); new GumshoeMap().MoveToWorld(new Point3D(6166, 2895, 7), map); new GumshoeTools().MoveToWorld(new Point3D(6160, 2901, 6), map); // Moonglow door = new TrapDoor("carthax", new Point3D(6198, 2893, 17), map); book = new MysteriousBook(door); dust = new DustPile(door); teleporter = new Teleporter(new Point3D(4550, 1306, 8), map); door.MoveToWorld(new Point3D(4550, 1306, 8), map); book.MoveToWorld(new Point3D(6207, 2884, 7), map); dust.MoveToWorld(new Point3D(6208, 2885, 12), map); teleporter.MoveToWorld(new Point3D(6198, 2893, 17), map); new GumshoeBottles().MoveToWorld(new Point3D(6198, 2888, 6), map); new GumshoeRope().MoveToWorld(new Point3D(6200, 2887, 0), map); new GumshoeRope().MoveToWorld(new Point3D(6200, 2887, 1), map); new GumshoeMap().MoveToWorld(new Point3D(6198, 2887, 6), map); new GumshoeMap().MoveToWorld(new Point3D(6198, 2887, 7), map); new GumshoeTools().MoveToWorld(new Point3D(6198, 2889, 6), map); // Vesper door = new TrapDoor("moriens", new Point3D(6154, 2898, 17), map); book = new MysteriousBook(door); dust = new DustPile(door); teleporter = new Teleporter(new Point3D(2762, 848, 0), map); door.MoveToWorld(new Point3D(2762, 848, 0), map); book.MoveToWorld(new Point3D(6167, 2896, 6), map); dust.MoveToWorld(new Point3D(6163, 2885, 0), map); teleporter.MoveToWorld(new Point3D(6154, 2898, 17), map); new GumshoeBottles().MoveToWorld(new Point3D(6240, 2884, 6), map); new GumshoeBottles().MoveToWorld(new Point3D(6239, 2885, 6), map); new GumshoeRope().MoveToWorld(new Point3D(6241, 2884, 0), map); new GumshoeRope().MoveToWorld(new Point3D(6241, 2884, 1), map); new GumshoeMap().MoveToWorld(new Point3D(6240, 2885, 6), map); new GumshoeMap().MoveToWorld(new Point3D(6240, 2885, 7), map); new GumshoeTools().MoveToWorld(new Point3D(6239, 2886, 6), map); // Yew door = new TrapDoor("tenebrae", new Point3D(6294, 2891, 17), map); book = new MysteriousBook(door); dust = new DustPile(door); teleporter = new Teleporter(new Point3D(712, 1104, 0), map); door.MoveToWorld(new Point3D(712, 1104, 0), map); book.MoveToWorld(new Point3D(6294, 2887, 6), map); dust.MoveToWorld(new Point3D(6291, 2875, 9), map); teleporter.MoveToWorld(new Point3D(6294, 2891, 17), map); new GumshoeBottles().MoveToWorld(new Point3D(6303, 2887, 6), map); new GumshoeBottles().MoveToWorld(new Point3D(6304, 2887, 6), map); new GumshoeRope().MoveToWorld(new Point3D(6299, 2887, 0), map); new GumshoeRope().MoveToWorld(new Point3D(6299, 2887, 1), map); new GumshoeMap().MoveToWorld(new Point3D(6294, 2888, 6), map); new GumshoeMap().MoveToWorld(new Point3D(6294, 2888, 7), map); new GumshoeTools().MoveToWorld(new Point3D(6294, 2889, 6), map); // Gravestones var grave = new DamagedHeadstone(1158607); // brit grave.MoveToWorld(new Point3D(1378, 1445, 10), map); grave = new DamagedHeadstone(1158608); // vesper grave.ItemID = 4477; grave.MoveToWorld(new Point3D(2747, 882, 0), map); grave = new DamagedHeadstone(1158609); // moonglow grave.MoveToWorld(new Point3D(4545, 1316, 8), map); grave = new DamagedHeadstone(1158610); // yew grave.MoveToWorld(new Point3D(723, 1104, 0), map); // footprints var footprints = new BloodyFootPrints(0x1E06); footprints.MoveToWorld(new Point3D(1383, 1452, 10), map); footprints = new BloodyFootPrints(0x1E06); footprints.MoveToWorld(new Point3D(1383, 1456, 10), map); footprints = new BloodyFootPrints(0x1E06); footprints.MoveToWorld(new Point3D(1383, 1461, 10), map); footprints = new BloodyFootPrints(0x1E06); footprints.MoveToWorld(new Point3D(1383, 1464, 10), map); footprints = new BloodyFootPrints(0x1E03); footprints.MoveToWorld(new Point3D(1378, 1464, 10), map); var st = new Static(0x2006); st.Stackable = true; st.Amount = 0x191; st.Hue = 0x47E; st.MoveToWorld(new Point3D(5808, 3270, -15), map); st.Name = "A Corpse of Liane"; st = new Static(0x2006); st.Stackable = true; st.Amount = 86; st.Hue = 0x47E; st.MoveToWorld(new Point3D(5807, 3268, -15), map); st.Name = "A Corpse of an Ophidian Beserker"; }
private void btnScheduleAdd_Click(object sender, EventArgs e) { Result res = new Result(); try { if (_core.RemoteObject.IsConnected && MessageBox.Show("Автоматаар хуваарилахдаа итгэлтэй байна уу? \n(Өмнө үүсэгсэн бичлэгүүдийг устгаад шинээр үүсгэнэ.)", _core.ApplicationTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (Static.ToInt(cboSchType.EditValue) == 0 && Static.ToDecimal(numSchAllAmount.EditValue) == 0) { MessageBox.Show("Төлбөрийн дүн тэг байна."); return; } if (Static.ToInt(cboSchType.EditValue) == 0) { if (dteSchStartDate.EditValue == null) { MessageBox.Show("Эхлэх огноог шалгана уу."); return; } } else { if (dteSchStartDate.EditValue == null) { MessageBox.Show("Эхлэх огноог шалгана уу."); return; } if (dteSchEndDate.EditValue == null) { MessageBox.Show("Дуусах огноог шалгана уу."); return; } } res = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 207, 130021, 130021, new object[] { Static.ToStr(txtContractNo.EditValue), Static.ToInt(cboSchType.EditValue), Static.ToStr(cboDateType.EditValue), Static.ToDate(dteSchStartDate.EditValue), Static.ToDate(dteSchEndDate.EditValue), Static.ToDecimal(numSchAmount.EditValue), Static.ToDecimal(numSchAllAmount.EditValue) }); if (res.ResultNo == 0) { RefreshDep(); MessageBox.Show("Амжилттай хуваариллаа."); } else { MessageBox.Show(Static.ToStr(res.ResultNo) + " " + res.ResultDesc); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void IPOSEODProcess_Load(object sender, EventArgs e) { appname = _core.ApplicationName; formname = "Process." + this.Name; FormName = this; ISM.Template.FormUtility.RestoreStateForm(appname, ref FormName); txtTxnDate.Text = Static.ToStr(_core.TxnDate.Year) + "." + Static.ToStr(_core.TxnDate.Month).PadLeft(2, '0') + "." + Static.ToStr(_core.TxnDate.Day).PadLeft(2, '0'); InitImage(); LoadEODProcess(); }
private void RefreshDep() { Result res = new Result(); try { grdDepSchedule.DataSource = null; res = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 207, 130016, 130016, new object[] { Static.ToStr(txtContractNo.EditValue) }); if (res.ResultNo == 0) { grdDepSchedule.DataSource = res.Data.Tables[0]; ucDepSchedule.FieldLinkSetSaveState(); ucDepSchedule.FieldLinkSetValues(); gvwDepSchedule.Columns[0].Caption = "Гэрээний дугаар"; gvwDepSchedule.Columns[0].Visible = false; gvwDepSchedule.Columns[1].Caption = "Элэгдүүлэх огноо"; gvwDepSchedule.Columns[2].Caption = "Элэгдүүлэх дүн"; } else { MessageBox.Show(Static.ToStr(res.ResultNo) + " " + res.ResultDesc); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static void CreateTeleporter( int xFrom, int yFrom, int xTo, int yTo ) { Static telePad = new Static( 0x1822 ); Teleporter teleItem = new Teleporter( new Point3D( xTo, yTo, -1 ), Map.Malas, false ); telePad.Hue = 0x482; telePad.MoveToWorld( new Point3D( xFrom, yFrom, -1 ), Map.Malas ); teleItem.MoveToWorld( new Point3D( xFrom, yFrom, -1 ), Map.Malas ); teleItem.SourceEffect = true; teleItem.DestEffect = true; teleItem.SoundID = 0x1FE; }
public Result DataRefresh(int pageno) { #region Validation if (pageno < 1) { pageno = 1; } object[] param = new object[] { _custno, _pledgeno }; #endregion #region Call server Result res = null; if (_remote != null) { gridControl1.DataSource = null; gridControl2.DataSource = null; gridControl2.RepositoryItems.Clear(); gridControl1.RepositoryItems.Clear(); res = _remote.Connection.Call(_remote.User.UserNo, 500, 500010, 500010, pageno - 1, _pagerows, param); if (res.ResultNo == 0) { PageSet(pageno, res); ISM.Template.FormUtility.GridLayoutGet(gridView1, res.Data.Tables[1], _layoutfilename); gridControl2.DataSource = res.Data.Tables[2]; gridView2.Columns[0].Caption = "Харилцагчийн №"; gridView2.Columns[1].Caption = "Овог, Нэр"; gridView2.Columns[2].Caption = "Барьцааны №"; gridView2.Columns[3].Caption = "Тэмдэглэл"; gridView2.Columns[4].Caption = "Огноо"; gridView2.Columns[5].Caption = "Таг №"; gridView2.Columns[0].Visible = false; gridView2.Columns[2].Visible = false; gridView2.Columns[3].Visible = false; gridView2.Columns[4].Visible = false; gridView2.Columns[4].Visible = false; gridView2.BestFitColumns(); if (firstrefresh == false) { #region Add picture column RepositoryItemPictureEdit ri = new RepositoryItemPictureEdit(); gridControl1.RepositoryItems.Add(ri); gridControl2.RepositoryItems.Add(ri); DevExpress.XtraGrid.Columns.GridColumn delcol = new DevExpress.XtraGrid.Columns.GridColumn(); delcol.VisibleIndex = gridView2.Columns.Count; delcol.Caption = "..."; delcol.FieldName = string.Format("DELETE"); delcol.ColumnEdit = ri; delcol.UnboundType = DevExpress.Data.UnboundColumnType.Object; delcol.OptionsColumn.ReadOnly = true; delcol.Width = 32; gridView2.Columns.Add(delcol); DevExpress.XtraGrid.Columns.GridColumn col = new DevExpress.XtraGrid.Columns.GridColumn(); col.VisibleIndex = gridView1.Columns.Count; col.Caption = "..."; col.FieldName = string.Format("PIC"); col.ColumnEdit = ri; col.UnboundType = DevExpress.Data.UnboundColumnType.Object; col.OptionsColumn.ReadOnly = true; col.Width = 32; gridView1.Columns.Add(col); #endregion firstrefresh = true; } DataColumnRefresh(); if (_pageno < _pagecount) { lblPage.Text = string.Format("Хуудас: {0}/{1}+", _pageno, _pagecount); } else { lblPage.Text = string.Format("Хуудас: {0}/{1}", _pageno, _pagecount); } DataTable dt0 = res.Data.Tables[0]; if (dt0.Rows.Count > 0) { memoEdit1.EditValue = Static.ToStr(dt0.Rows[0]["note"]); } } } else { res = new Result(1000, "Internal Error: Remote object not set."); } #endregion return(res); }
public Item Construct() { Item item; try { if (m_Type == typeofStatic) { item = new Static(m_ItemID); } else if (m_Type == typeofLocalizedStatic) { int labelNumber = 0; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("LabelNumber")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { labelNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf)); break; } } } item = new LocalizedStatic(m_ItemID, labelNumber); } else if (m_Type == typeofLocalizedSign) { int labelNumber = 0; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("LabelNumber")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { labelNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf)); break; } } } item = new LocalizedSign(m_ItemID, labelNumber); } else if (m_Type == typeofAnkhWest || m_Type == typeofAnkhNorth) { bool bloodied = false; for (int i = 0; !bloodied && i < m_Params.Length; ++i) { bloodied = (m_Params[i] == "Bloodied"); } if (m_Type == typeofAnkhWest) { item = new AnkhWest(bloodied); } else { item = new AnkhNorth(bloodied); } } else if (m_Type == typeofMarkContainer) { bool bone = false; bool locked = false; Map map = Map.Malas; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i] == "Bone") { bone = true; } else if (m_Params[i] == "Locked") { locked = true; } else if (m_Params[i].StartsWith("TargetMap")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { map = Map.Parse(m_Params[i].Substring(++indexOf)); } } } MarkContainer mc = new MarkContainer(bone, locked); mc.TargetMap = map; mc.Description = "strange location"; item = mc; } else if (m_Type == typeofHintItem) { int range = 0; int messageNumber = 0; string messageString = null; int hintNumber = 0; string hintString = null; TimeSpan resetDelay = TimeSpan.Zero; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Range")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { range = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("WarningString")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { messageString = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("WarningNumber")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { messageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("HintString")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { hintString = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("HintNumber")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { hintNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("ResetDelay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { resetDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } } HintItem hi = new HintItem(m_ItemID, range, messageNumber, hintNumber); hi.WarningString = messageString; hi.HintString = hintString; hi.ResetDelay = resetDelay; item = hi; } else if (m_Type == typeofWarningItem) { int range = 0; int messageNumber = 0; string messageString = null; TimeSpan resetDelay = TimeSpan.Zero; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Range")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { range = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("WarningString")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { messageString = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("WarningNumber")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { messageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("ResetDelay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { resetDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } } WarningItem wi = new WarningItem(m_ItemID, range, messageNumber); wi.WarningString = messageString; wi.ResetDelay = resetDelay; item = wi; } else if (m_Type == typeofCannon) { CannonDirection direction = CannonDirection.North; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("CannonDirection")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { direction = (CannonDirection)Enum.Parse(typeof(CannonDirection), m_Params[i].Substring(++indexOf), true); } } } item = new Cannon(direction); } else if (m_Type == typeofSerpentPillar) { string word = null; Rectangle2D destination = new Rectangle2D(); for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Word")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { word = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("DestStart")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { destination.Start = Point2D.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("DestEnd")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { destination.End = Point2D.Parse(m_Params[i].Substring(++indexOf)); } } } item = new SerpentPillar(word, destination); } else if (m_Type.IsSubclassOf(typeofBeverage)) { BeverageType content = BeverageType.Liquor; bool fill = false; for (int i = 0; !fill && i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Content")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { content = (BeverageType)Enum.Parse(typeof(BeverageType), m_Params[i].Substring(++indexOf), true); fill = true; } } } if (fill) { item = (Item)Activator.CreateInstance(m_Type, new object[] { content }); } else { item = (Item)Activator.CreateInstance(m_Type); } } else if (m_Type.IsSubclassOf(typeofBaseDoor)) { DoorFacing facing = DoorFacing.WestCW; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Facing")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { facing = (DoorFacing)Enum.Parse(typeof(DoorFacing), m_Params[i].Substring(++indexOf), true); break; } } } item = (Item)Activator.CreateInstance(m_Type, new object[] { facing }); } else { item = (Item)Activator.CreateInstance(m_Type); } } catch (Exception e) { throw new Exception(String.Format("Bad type: {0}", m_Type), e); } if (item is BaseAddon) { if (item is MaabusCoffin) { MaabusCoffin coffin = (MaabusCoffin)item; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("SpawnLocation")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { coffin.SpawnLocation = Point3D.Parse(m_Params[i].Substring(++indexOf)); } } } } else if (m_ItemID > 0) { List <AddonComponent> comps = ((BaseAddon)item).Components; for (int i = 0; i < comps.Count; ++i) { AddonComponent comp = (AddonComponent)comps[i]; if (comp.Offset == Point3D.Zero) { comp.ItemID = m_ItemID; } } } } else if (item is BaseLight) { bool unlit = false, unprotected = false; for (int i = 0; i < m_Params.Length; ++i) { if (!unlit && m_Params[i] == "Unlit") { unlit = true; } else if (!unprotected && m_Params[i] == "Unprotected") { unprotected = true; } if (unlit && unprotected) { break; } } if (!unlit) { ((BaseLight)item).Ignite(); } if (!unprotected) { ((BaseLight)item).Protected = true; } if (m_ItemID > 0) { item.ItemID = m_ItemID; } } else if (item is Server.Mobiles.Spawner) { Server.Mobiles.Spawner sp = (Server.Mobiles.Spawner)item; sp.NextSpawn = TimeSpan.Zero; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Spawn")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.CreaturesName.Add(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("MinDelay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.MinDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("MaxDelay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.MaxDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("NextSpawn")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.NextSpawn = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Count")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.Count = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Team")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.Team = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("HomeRange")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.HomeRange = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Running")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.Running = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Group")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { sp.Group = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } } } else if (item is RecallRune) { RecallRune rune = (RecallRune)item; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Description")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { rune.Description = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("Marked")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { rune.Marked = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("TargetMap")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { rune.TargetMap = Map.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Target")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { rune.Target = Point3D.Parse(m_Params[i].Substring(++indexOf)); } } } } else if (item is SkillTeleporter) { SkillTeleporter tp = (SkillTeleporter)item; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Skill")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Skill = (SkillName)Enum.Parse(typeof(SkillName), m_Params[i].Substring(++indexOf), true); } } else if (m_Params[i].StartsWith("RequiredFixedPoint")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Required = Utility.ToInt32(m_Params[i].Substring(++indexOf)) * 0.01; } } else if (m_Params[i].StartsWith("Required")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Required = Utility.ToDouble(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("MessageString")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.MessageString = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("MessageNumber")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.MessageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("PointDest")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("MapDest")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.MapDest = Map.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Creatures")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("SourceEffect")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("DestEffect")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("SoundID")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Delay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } } if (m_ItemID > 0) { item.ItemID = m_ItemID; } } else if (item is KeywordTeleporter) { KeywordTeleporter tp = (KeywordTeleporter)item; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Substring")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Substring = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("Keyword")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Keyword = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Range")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Range = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("PointDest")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("MapDest")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.MapDest = Map.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Creatures")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("SourceEffect")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("DestEffect")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("SoundID")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Delay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } } if (m_ItemID > 0) { item.ItemID = m_ItemID; } } else if (item is Teleporter) { Teleporter tp = (Teleporter)item; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("PointDest")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("MapDest")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.MapDest = Map.Parse(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Creatures")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("SourceEffect")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("DestEffect")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("SoundID")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf)); } } else if (m_Params[i].StartsWith("Delay")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { tp.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf)); } } } if (m_ItemID > 0) { item.ItemID = m_ItemID; } } else if (item is FillableContainer) { FillableContainer cont = (FillableContainer)item; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("ContentType")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { cont.ContentType = (FillableContentType)Enum.Parse(typeof(FillableContentType), m_Params[i].Substring(++indexOf), true); } } } if (m_ItemID > 0) { item.ItemID = m_ItemID; } } else if (m_ItemID > 0) { item.ItemID = m_ItemID; } item.Movable = false; for (int i = 0; i < m_Params.Length; ++i) { if (m_Params[i].StartsWith("Light")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { item.Light = (LightType)Enum.Parse(typeof(LightType), m_Params[i].Substring(++indexOf), true); } } else if (m_Params[i].StartsWith("Hue")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { int hue = Utility.ToInt32(m_Params[i].Substring(++indexOf)); if (item is DyeTub) { ((DyeTub)item).DyedHue = hue; } else { item.Hue = hue; } } } else if (m_Params[i].StartsWith("Name")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { item.Name = m_Params[i].Substring(++indexOf); } } else if (m_Params[i].StartsWith("Amount")) { int indexOf = m_Params[i].IndexOf('='); if (indexOf >= 0) { // Must supress stackable warnings bool wasStackable = item.Stackable; item.Stackable = true; item.Amount = Utility.ToInt32(m_Params[i].Substring(++indexOf)); item.Stackable = wasStackable; } } } return(item); }
public Result Deliver() { Result res = null; try { DataRow currentrow = gridView1.GetFocusedDataRow(); if (currentrow == null) { res = new Result(9, "Барьцаа сонгогдоогүй байна!"); ISM.Template.FormUtility.ValidateQuery(res); return(res); } string rowid = Static.ToStr(currentrow["rowid"]); int userno = _core.RemoteObject.User.UserNo; string docno = Static.ToStr(currentrow["docno"]); int status = Static.ToInt(currentrow["status"]); #region Validation if (status > 0) { res = new Result(9, "Чөлөөлөгдсөн бичиг баримт."); ISM.Template.FormUtility.ValidateQuery(res); return(res); } if (!ISM.Template.FormUtility.ValidateConfirm(string.Format("Та [{0}] дугаартай бичиг баримтыг олгохдоо итгэлтэй байна уу?", docno))) { return(new Result(9, "Үйлдлээ цуцлав.")); } #endregion #region Prepare parameters object[] param = new object[] { _custno, _pledgeno, rowid, userno }; #endregion #region Call server if (_remote != null) { res = _remote.Connection.Call(_remote.User.UserNo, 500, 500012, 500012, param); if (res != null && res.ResultNo == 0) { res = DataRefresh(1); } } else { res = new Result(1000, "Internal Error: Remote object not set."); } #endregion } catch (Exception ex) { res = new Result(99999, ex.ToString()); } return(res); }
public override void OnDoubleClick(Mobile m) { if (IsChildOf(m.Backpack)) { m.SendLocalizedMessage(1010086); // What do you want to use this on? m.BeginTarget(3, false, Server.Targeting.TargetFlags.None, (from, targeted) => { if (targeted is PurifyingFlames) { var flames = targeted as PurifyingFlames; if (!from.InLOS(flames)) { from.SendLocalizedMessage(500237); // Target cannot be seen. } else if (!Purified) { m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156225, m.NetState); // *You purify the phylactery!* Effects.SendLocationParticles(EffectItem.Create(flames.Location, flames.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(flames.Location, flames.Map, 0x225); //TODO: Get sound Purified = true; InvalidateProperties(); } } else if (targeted is CursedSuitOfArmor) { var armor = targeted as CursedSuitOfArmor; if (!from.InLOS(armor)) { from.SendLocalizedMessage(500237); // Target cannot be seen. } else if (!_Purified) { m.SendLocalizedMessage(1156224); // *The cursed armor rejects the phylactery!* } else { m.SendLocalizedMessage(1156222); // *You throw the phylactery at the armor causing it to disintegrate!* Map map = armor.Map; Point3D p; if (armor.ItemID == 5402) { p = new Point3D(armor.X - 1, armor.Y, armor.Z); } else { p = new Point3D(armor.X, armor.Y - 1, armor.Z); } armor.Delete(); Delete(); Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 2720, 7, 5052, 0); Effects.PlaySound(p, map, 0x225); //TODO: Get sound Timer.DelayCall(TimeSpan.FromSeconds(1), () => { Item item = new Static(Utility.Random(8762, 16)); item.Hue = 1111; item.Name = "Broken Armor"; item.MoveToWorld(p, Map.TerMur); ArmoryEncounter encounter = ShadowguardController.GetEncounter(p, Map.TerMur) as ArmoryEncounter; if (encounter != null) { encounter.AddDestroyedArmor(item); } int ticks = 1; Timer.DelayCall(TimeSpan.FromMilliseconds(50), TimeSpan.FromMilliseconds(50), 2, () => { Server.Misc.Geometry.Circle2D(p, map, ticks, (pnt, mob) => { Effects.PlaySound(pnt, mob, 0x307); Effects.SendLocationEffect(pnt, mob, Utility.RandomBool() ? 14000 : 14013, 20, 2018, 0); }); ticks++; }); }); } } }); } }
private void AutoSend(object obj) { object[] o = (object[])obj; RevMessageEvent e = (RevMessageEvent)o[0]; string message = o[1].ToString(); int time = Convert.ToInt32(o[2]); if (time > 0) { while (thread.ContainsKey(e.group_id)) { Cluster.Send(e.group_id, message); Thread.Sleep(time * 1000); } } else { if (message == "发送消息") { message = "这是测试【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "】"; Cluster.Send(e.group_id, "执行API:http://127.0.0.1:" + Robot.port + "/send_group_msg?group_id=" + e.group_id + "&message=" + Static.UrlEncode(message)); Thread.Sleep(100); } Cluster.Send(e.group_id, message); } try { if (thread.ContainsKey(e.group_id)) { thread.Remove(e.group_id); } // Cluster.Send(e.group_id, "自动化已停止"); OnLog("自动化已停止"); } catch (ThreadAbortException ex) { } catch (Exception ex) { } finally { } }
private static void DoUnfreeze( Map map, Point2D start, Point2D end, ref bool badDataFile, ref int totalUnfrozen ) { start = map.Bound( start ); end = map.Bound( end ); int xStartBlock = start.X >> 3; int yStartBlock = start.Y >> 3; int xEndBlock = end.X >> 3; int yEndBlock = end.Y >> 3; int xTileStart = start.X, yTileStart = start.Y; int xTileWidth = end.X - start.X + 1, yTileHeight = end.Y - start.Y + 1; TileMatrix matrix = map.Tiles; using ( FileStream idxStream = OpenWrite( matrix.IndexStream ) ) { using ( FileStream mulStream = OpenWrite( matrix.DataStream ) ) { if ( idxStream == null || mulStream == null ) { badDataFile = true; return; } BinaryReader idxReader = new BinaryReader( idxStream ); BinaryWriter idxWriter = new BinaryWriter( idxStream ); BinaryWriter mulWriter = new BinaryWriter( mulStream ); for ( int x = xStartBlock; x <= xEndBlock; ++x ) { for ( int y = yStartBlock; y <= yEndBlock; ++y ) { int oldTileCount; StaticTile[] oldTiles = ReadStaticBlock( idxReader, mulStream, x, y, matrix.BlockWidth, matrix.BlockHeight, out oldTileCount ); if ( oldTileCount < 0 ) continue; int newTileCount = 0; StaticTile[] newTiles = new StaticTile[oldTileCount]; int baseX = (x << 3) - xTileStart, baseY = (y << 3) - yTileStart; for ( int i = 0; i < oldTileCount; ++i ) { StaticTile oldTile = oldTiles[i]; int px = baseX + oldTile.m_X; int py = baseY + oldTile.m_Y; if ( px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight ) { newTiles[newTileCount++] = oldTile; } else { ++totalUnfrozen; Item item = new Static( oldTile.m_ID & 0x3FFF ); item.Hue = oldTile.m_Hue; item.MoveToWorld( new Point3D( px + xTileStart, py + yTileStart, oldTile.m_Z ), map ); } } int mulPos = -1; int length = -1; int extra = 0; if ( newTileCount > 0 ) { mulWriter.Seek( 0, SeekOrigin.End ); mulPos = (int)mulWriter.BaseStream.Position; length = newTileCount * 7; extra = 1; for ( int i = 0; i < newTileCount; ++i ) { StaticTile toWrite = newTiles[i]; mulWriter.Write( (short) toWrite.m_ID ); mulWriter.Write( (byte) toWrite.m_X ); mulWriter.Write( (byte) toWrite.m_Y ); mulWriter.Write( (sbyte) toWrite.m_Z ); mulWriter.Write( (short) toWrite.m_Hue ); } mulWriter.Flush(); } int idxPos = ((x * matrix.BlockHeight) + y) * 12; idxWriter.Seek( idxPos, SeekOrigin.Begin ); idxWriter.Write( mulPos ); idxWriter.Write( length ); idxWriter.Write( extra ); idxWriter.Flush(); matrix.SetStaticBlock( x, y, null ); } } } } }
private void RecreateItems() { foreach (DecoreItemInfo info in c_DecoreItemInfos) { Item item = null; if (info.TypeString.ToLower().IndexOf("static", StringComparison.Ordinal) != -1) { item = new Static(info.ItemID); } else { try { item = Activator.CreateInstance(ScriptCompiler.FindTypeByFullName(info.TypeString)) as Item; } catch { continue; } } if (item == null) { continue; } item.ItemID = info.ItemID; item.Name = info.Name; item.Hue = info.Hue; item.Location = info.Location; item.Map = info.Map; item.Movable = false; } }