public override async Task OnActionAsync(L2Player player) { await player.SendMessageAsync(AsString()); // TimeSpan ts = dtstart - DateTime.Now; // player.sendMessage($"timems {(ts.TotalMilliseconds)}"); bool newtarget = false; if (player.Target == null) { player.Target = this; newtarget = true; } else { if (player.Target.ObjectId != ObjectId) { player.Target = this; newtarget = true; } } if (newtarget) { await player.SendPacketAsync(new MyTargetSelected(ObjectId, player.Level - Template.Level)); StatusUpdate su = new StatusUpdate(this); su.Add(StatusUpdate.CurHp, (int)CharStatus.CurrentHp); su.Add(StatusUpdate.MaxHp, (int)MaxHp); await player.SendPacketAsync(su); } }
public override void OnAction(L2Player player) { player.SendMessage(AsString()); // TimeSpan ts = dtstart - DateTime.Now; // player.sendMessage($"timems {(ts.TotalMilliseconds)}"); bool newtarget = false; if (player.CurrentTarget == null) { player.CurrentTarget = this; newtarget = true; } else { if (player.CurrentTarget.ObjId != ObjId) { player.CurrentTarget = this; newtarget = true; } } if (newtarget) { player.SendPacket(new MyTargetSelected(ObjId, player.Level - Template.Level)); StatusUpdate su = new StatusUpdate(ObjId); su.Add(StatusUpdate.CurHp, (int)CurHp); su.Add(StatusUpdate.MaxHp, (int)CharacterStat.GetStat(EffectType.BMaxHp)); player.SendPacket(su); } else { player.AiCharacter.Attack(this); } }
public override void OnStopMoving(L2Player player) { player.CharacterStat.SpecBonusEvasion -= Value; StatusUpdate su = new StatusUpdate(player.ObjId); su.Add(StatusUpdate.Evasion, (int)player.CharacterStat.GetStat(EffectType.BEvasion)); player.SendPacket(su); }
protected internal override void Use(L2Player admin, string alias) { //healthy -- восстанавливает выбранному чару хп\мп L2Player target; if (admin.Target is L2Player) { target = (L2Player)admin.Target; } else { target = admin; } double hpval = target.MaxHp; double mpval = target.MaxMp; target.CharStatus.SetCurrentHp(target.MaxHp); target.CharStatus.SetCurrentMp(target.MaxMp); StatusUpdate su = new StatusUpdate(target); su.Add(StatusUpdate.CurHp, (int)target.CharStatus.CurrentHp); su.Add(StatusUpdate.CurMp, (int)target.CharStatus.CurrentMp); target.SendPacket(su); SystemMessage sm = new SystemMessage(SystemMessage.SystemMessageId.S2HpRestoredByS1); sm.AddPlayerName(admin.Name); sm.AddNumber((int)hpval); target.SendPacket(sm); sm = new SystemMessage(SystemMessage.SystemMessageId.S2MpRestoredByS1); sm.AddPlayerName(admin.Name); sm.AddNumber((int)mpval); target.SendPacket(sm); }
public virtual void BroadcastStatusUpdate() { if (!CharStatus.StatusListener.Any()) { return; } //will look into this later //if (!needHpUpdate(352)) // return; StatusUpdate su = new StatusUpdate(this); su.Add(StatusUpdate.CurHp, (int)CharStatus.CurrentHp); foreach (var temp in CharStatus.StatusListener) { if (temp.ObjId != ObjId) { temp?.SendPacket(su); } } }
public override void ReduceHp(L2Character attacker, double damage) { if (Dead) { return; } //if ((this is L2Player && attacker is L2Player)) //{ // if (CurCp > 0) // { // CurCp -= damage; // if (CurCp < 0) // { // damage = CurCp * -1; // CurCp = 0; // } // } //} CurHp -= damage; StatusUpdate su = new StatusUpdate(this); su.Add(StatusUpdate.CurHp, (int)CurHp); // su.Add(StatusUpdate.CurCp, (int)CurCp); BroadcastPacket(su); if (CurHp <= 0) { CurHp = 0; DoDie(attacker); return; } }
public override void RunImpl() { L2Player player = _client.CurrentPlayer; if (player.RecipeBook == null) { player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect); player.SendActionFailed(); return; } L2Recipe rec = player.RecipeBook.FirstOrDefault(r => r.RecipeId == _id); if (rec == null) { player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect); player.SendActionFailed(); return; } if (player.CurMp < rec.MpConsume) { player.SendSystemMessage(SystemMessage.SystemMessageId.NotEnoughMp); player.SendActionFailed(); return; } bool next; if (rec.Iscommonrecipe == 0) { next = player.PCreateItem >= rec.Level; } else { next = player.PCreateCommonItem >= rec.Level; } if (!next) { player.SendSystemMessage(SystemMessage.SystemMessageId.CreateLvlTooLowToRegister); player.SendActionFailed(); return; } player.CurMp -= rec.MpConsume; StatusUpdate su = new StatusUpdate(player); su.Add(StatusUpdate.CurMp, (int)player.CurMp); player.SendPacket(su); rec.Materials.ForEach(material => player.DestroyItemById(material.Item.ItemId, material.Count)); if (rec.SuccessRate < 100) { if (new Random().Next(0, 100) > rec.SuccessRate) { player.SendPacket(new RecipeItemMakeInfo(player, rec, 0)); player.SendActionFailed(); return; } } rec.Products.ForEach(prod => player.SendPacket(new RecipeItemMakeInfo(player, rec, 1))); }
public override void RunImpl() { L2Player player = _client.CurrentPlayer; SortedList <int, AcquireSkill> seq = player.ActiveSkillTree; if ((seq == null) || !seq.ContainsKey(_id)) { player.SendActionFailed(); return; } AcquireSkill e = seq[_id]; if (e.Lv != _level) { player.SendActionFailed(); return; } if (e.LvUpSp > player.Sp) { player.SendSystemMessage(SystemMessage.SystemMessageId.NotEnoughSpToLearnSkill); player.SendActionFailed(); return; } //if (e.itemid > 0) // if (!player.hasItem(e.itemid, e.itemcount)) // { // player.sendSystemMessage(SystemMessage.SystemMessageId.ITEM_MISSING_TO_LEARN_SKILL); // player.sendActionFailed(); // return; // } if (e.LvUpSp > 0) { player.Sp -= e.LvUpSp; StatusUpdate su = new StatusUpdate(player.ObjId); su.Add(StatusUpdate.Sp, player.Sp); player.SendPacket(su); } player.DestroyItemById(e.ItemId, e.ItemCount); Skill skill = SkillTable.Instance.Get(e.Id, e.Lv); if (skill != null) { player.AddSkill(skill, true, true); } else { player.SendMessage("failed to learn null skill"); player.SendActionFailed(); return; } if (_level > 1) { bool upd = false; lock (player.Shortcuts) { foreach (L2Shortcut sc in player.Shortcuts.Where(sc => (sc.Type == L2Shortcut.TypeSkill) && (sc.Id == _id))) { sc.Level = _level; upd = true; } } if (upd) { player.SendPacket(new ShortCutInit(player)); } } player.ActiveSkillTree.Remove(_id); player.FolkNpc.ShowAvailRegularSkills(player, true); }