public AnimatedItemEffect(int Source, int xSource, int ySource, int zSource, int ItemID, IHue Hue, int duration) : this(ItemID, Hue, duration) { Mobile mobile = World.FindMobile(Source); if (mobile != null) { this.SetSource(mobile); if (mobile.Player || mobile.IsMoving || xSource == 0 && ySource == 0 && zSource == 0) { return; } mobile.SetLocation(xSource, ySource, zSource); mobile.Update(); mobile.UpdateReal(); } else { Item Source1 = World.FindItem(Source); if (Source1 != null) { this.SetSource(Source1); if (xSource == 0 && ySource == 0 && zSource == 0) { return; } Source1.SetLocation(xSource, ySource, zSource); Source1.Update(); } else { this.SetSource(xSource, ySource, zSource); } } }
public MovingEffect(int Source, int Target, int xSource, int ySource, int zSource, int xTarget, int yTarget, int zTarget, int ItemID, IHue Hue) : this(ItemID, Hue) { Mobile mobile1 = World.FindMobile(Source); if (mobile1 != null) { this.SetSource(mobile1); if (!mobile1.Player && !mobile1.IsMoving && (xSource != 0 || ySource != 0 || zSource != 0)) { mobile1.SetLocation(xSource, ySource, zSource); mobile1.Update(); mobile1.UpdateReal(); } } else { Item Source1 = World.FindItem(Source); if (Source1 != null) { this.SetSource(Source1); if (xSource != 0 || ySource != 0 || zSource != 0) { Source1.SetLocation(xSource, ySource, zSource); Source1.Update(); } } else { this.SetSource(xSource, ySource, zSource); } } Mobile mobile2 = World.FindMobile(Target); if (mobile2 != null) { this.SetTarget(mobile2); if (mobile2.Player || mobile2.IsMoving || xTarget == 0 && yTarget == 0 && zTarget == 0) { return; } mobile2.SetLocation(xTarget, yTarget, zTarget); mobile2.Update(); mobile2.UpdateReal(); } else { Item Target1 = World.FindItem(Target); if (Target1 != null) { this.SetTarget(Target1); if (xTarget == 0 && yTarget == 0 && zTarget == 0) { return; } Target1.SetLocation(xTarget, yTarget, zTarget); Target1.Update(); } else { this.SetTarget(xTarget, yTarget, zTarget); } } }
private Mobile ReadMobile(BinaryReader ip, bool isPlayer) { Mobile mobile = World.WantMobile(ip.ReadInt32()); if (isPlayer) { World.Serial = mobile.Serial; } int x = ip.ReadInt32(); int y = ip.ReadInt32(); int z = ip.ReadInt32(); if (isPlayer) { World.SetLocation(x, y, z); } mobile.SetLocation((Agent)World.Agent, x, y, z); mobile.Refresh = true; mobile.Hue = ip.ReadUInt16(); mobile.Body = ip.ReadUInt16(); mobile.Direction = ip.ReadByte(); mobile.Name = ip.ReadString(); mobile.Notoriety = (Notoriety)ip.ReadByte(); mobile.Flags.Value = (int)ip.ReadByte(); mobile.MaximumHitPoints = (int)ip.ReadUInt16(); mobile.CurrentHitPoints = (int)ip.ReadUInt16(); mobile.UpdateReal(); int num1 = (int)ip.ReadByte(); int num2 = ip.ReadInt32(); while (num2-- > 0) { int num3 = (int)ip.ReadUInt32(); } if (isPlayer) { mobile.Strength = (int)ip.ReadUInt16(); mobile.Dexterity = (int)ip.ReadUInt16(); mobile.Intelligence = (int)ip.ReadUInt16(); mobile.MaximumStamina = (int)ip.ReadUInt16(); mobile.CurrentStamina = (int)ip.ReadUInt16(); mobile.MaximumMana = (int)ip.ReadUInt16(); mobile.CurrentMana = (int)ip.ReadUInt16(); int num4 = (int)ip.ReadByte(); int num5 = (int)ip.ReadByte(); int num6 = (int)ip.ReadByte(); mobile.Gold = ip.ReadInt32(); mobile.Weight = (int)ip.ReadUInt16(); if (this._version < 4) { throw new InvalidOperationException(); } int num7 = (int)ip.ReadByte(); for (int index = 0; index < num7; ++index) { Skill skill = Engine.Skills[index]; if (skill != null) { skill.Real = (float)ip.ReadUInt16() / 10f; int num8 = (int)ip.ReadUInt16(); skill.Value = (float)ip.ReadUInt16() / 10f; skill.Lock = (SkillLock)ip.ReadByte(); } else { int num8 = (int)ip.ReadInt16(); int num9 = (int)ip.ReadInt16(); int num10 = (int)ip.ReadInt16(); int num11 = (int)ip.ReadByte(); } } mobile.Armor = (int)ip.ReadUInt16(); mobile.StatCap = (int)ip.ReadUInt16(); mobile.FollowersCur = (int)ip.ReadByte(); mobile.FollowersMax = (int)ip.ReadByte(); mobile.TithingPoints = ip.ReadInt32(); mobile.LightLevel = (int)ip.ReadSByte(); Engine.Effects.GlobalLight = (int)ip.ReadByte(); int num12 = (int)ip.ReadUInt16(); int num13 = (int)ip.ReadByte(); int num14 = (int)ip.ReadByte(); while (num14-- > 0) { ip.ReadInt32(); } } mobile.Refresh = false; mobile.Update(); return(mobile); }
/// <summary> /// マークを選択時 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public async void img_Click(View view, object args) { // 再入禁止 if (_flag == true) { return; } _flag = true; Image mark = view as Image; if (mark == _sel1) { _sel1 = null; mark.Opacity = 1.0; } else if (mark == _sel2) { _sel2 = null; mark.Opacity = 1.0; } else { if (_sel1 == null) { mark.Opacity = 0.7; _sel1 = mark; } else { mark.Opacity = 0.7; _sel2 = mark; // カウンタを減らす _model.RestMove--; if (_model.RestMove >= 0) { // ここでスワップ&チェック... await LogicCheck(); _sel1.Opacity = 1.0; _sel2.Opacity = 1.0; _sel1 = _sel2 = null; } // 状態をローカルストレージに保存 var se = new XmlSerializer(typeof(MyData)); #if __IOS__ || __ANDROID__ var documents = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); var file = System.IO.Path.Combine(documents, "mydata.xml"); using (var stream = System.IO.File.OpenWrite(file)) { var m = new MyData(); m.CopyFrom(_model); stream.SetLength(0); stream.Position = 0; se.Serialize(stream, m); } #else using (var stream = await Windows.Storage.ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync( "mydata.xml", Windows.Storage.CreationCollisionOption.OpenIfExists)) { var m = new MyData(); m.CopyFrom(_model); stream.SetLength(0); stream.Position = 0; se.Serialize(stream, m); } #endif if (_model.RestMove == 0) { // 終了した場合はモバイルサービスへ登録 await _mobile.Update(new MobileData { UserName = _model.UserName, Score = _model.Score }); } } } _flag = false; }