Нотис на готовность скилла

jr

Administrator
Команда форума
Скрипт отображает нотис на кд реса пати мемберов.
При первой компиляции скрипта (нажатие кнопки применить) скрипта в папке с хелпером появляется файл ResNoticeSettings.json.
Его можно открыть при помощи блокнота.
В файле 3 настройки:
1-ая Position это число от 0 до 8 соответствующее положению нотиса на экране. 0 - верхний левый угол, 1 - верхний центр и до 8 - нижний правый угол.
2-ая SeMassRes: true или false. Отображение кд масс реса у Shillen Elder. true- отображается, false-не отображается.
3-яя HasNeckl: через запятую ники в кавычках. Это ники патимейтов у которых есть ожерелье увеличивающее откат (считается для кд реса).
4,5-ая Дефолтный откат реса и масс реса Без бафа с пасивкой Quick Recycle 3lvl.
При желании можно вернуть к настройкам по умолчанию, при удалении файла ResNoticeSettings.json.

C#:
using System;
using System.Linq;
using System.Collections.Generic;
using NewWidget.Core;
using NewWidget.Core.Native;
using NewWidget.Core.Scripting;
using System.Windows.Forms;
using System.Drawing;

public class Script : ScriptBase {
    bool SeMassRes = false;
    Notification _notice;
    Notification _notice1;
    Notification _notice2;
    L2Player healer1;
    L2Player healer2;
    L2Player healer3;
    string heal1Name;
    string heal2Name;
    string heal3Name;
    bool disable1;
    bool disable2;
    bool disable3;
    bool rescd1 = false;
    bool rescd2 = false;
    bool rescd3 = false;
    int _ResCoolDown1;
    int _ResCoolDown2;
    int _ResCoolDown3;
    int _MassResCoolDown1;
    int _MassResCoolDown2;
    int _MassResCoolDown3;
    int[] MassResClasses = {16, 97, 112};
    
    public override void OnStart() {
        base.OnStart();
        _notice = new Notification();
        _notice2 = new Notification();
        _notice1 = new Notification();
        GetSettings();
        EnabledChanged(true, () => ScriptPauseOff());
        EnabledChanged(false, () => ScriptPauseOn());
        
        CastStarted(actor => actor.Cast.Id == 1254 && actor.IsPartyMate && actor == healer1, actor => _MassResCoolDown1 = (ResCoolDown(actor, settings.DefaultMassResCd) + Environment.TickCount));
        CastStarted(actor => actor.Cast.Id == 1254 && actor.IsPartyMate && actor == healer2, actor => _MassResCoolDown2 = (ResCoolDown(actor, settings.DefaultMassResCd) + Environment.TickCount));
        CastStarted(actor => actor.Cast.Id == 1254 && actor.IsPartyMate && actor == healer3, actor => _MassResCoolDown3 = (ResCoolDown(actor, settings.DefaultMassResCd) + Environment.TickCount));
        
        CastStarted(actor => actor.Cast.Id == 1016 && actor.IsPartyMate && actor == healer1, actor => {rescd1 = true; _ResCoolDown1 = (ResCoolDown(actor, settings.DefaultResCd) + Environment.TickCount);});
        CastStarted(actor => actor.Cast.Id == 1016 && actor.IsPartyMate && actor == healer2, actor => {rescd2 = true; _ResCoolDown2 = (ResCoolDown(actor, settings.DefaultResCd) + Environment.TickCount);});
        CastStarted(actor => actor.Cast.Id == 1016 && actor.IsPartyMate && actor == healer3, actor => {rescd3 = true; _ResCoolDown3 = (ResCoolDown(actor, settings.DefaultResCd) + Environment.TickCount);});
        
        if(!SeMassRes) MassResClasses[2] = 199;
        
        _notice.Duration = -1;
        _notice.FontSize = 14;
        
        _notice1.Duration = -1;
        _notice1.FontSize = 14;
        
        _notice2.Duration = -1;
        _notice2.FontSize = 14;
        
        NoticeRestart();
        CreateTimer(200, NoticeUpdate);
        CreateTimer(500, PartyCheking);
    }
    
    Settings settings;
    
    void GetSettings()
    {
        if (!System.IO.File.Exists(L2Helper.BaseDirectory + "ResNoticeSettings.json"))
        {
            var HasNeckl = new string[]{"biba", "boba", "vasja"};
            var defaultSettings = new Settings(8, false, HasNeckl, 24000, 120000);
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(defaultSettings);
            System.IO.File.WriteAllText(L2Helper.BaseDirectory + "ResNoticeSettings.json", json);
            settings = defaultSettings;
        }
        else
        {
            var _settings = new Settings();
            var json = System.IO.File.ReadAllText(L2Helper.BaseDirectory + "ResNoticeSettings.json");
            _settings = Newtonsoft.Json.JsonConvert.DeserializeObject<Settings>(json);
            settings = _settings;
        }
        _notice.Position = settings.Position;
        _notice1.Position = settings.Position;
        _notice2.Position = settings.Position;
        
    }
    
    class Settings
    {
        public int Position;
        public bool SeMassRes;
        public string[] HasNeckl;
        public int DefaultResCd;
        public int DefaultMassResCd;
        
        public Settings(int pos, bool _seMr, string[] _hasNeckl, int _drc, int _dmrcd)
        {
            Position = pos;
            SeMassRes = _seMr;
            HasNeckl = _hasNeckl;
            DefaultResCd = _drc;
            DefaultMassResCd = _dmrcd;
        }
        public Settings(){}
    }

    void ScriptPauseOn(){
        Client.NotificationManager.Clear(settings.Position);
    }
    
    void ScriptPauseOff(){
        GetSettings();
        NoticeRestart();
    }
    void NoticeRestart(){
        Client.NotificationManager.Clear(settings.Position);
        int[] healersIds = {105, 112, 97, 16, 43, 30};
        healer1 = null;
        healer2 = null;
        healer3 = null;
        _notice.Text = "";
        _notice1.Text = "";
        _notice2.Text = "";
        healer1 = PartyMembers.FirstOrDefault(p => healersIds.Contains(p.Class.Id));
        healer2 = PartyMembers.FirstOrDefault(p => healersIds.Contains(p.Class.Id) && p != healer1);
        healer3 = PartyMembers.FirstOrDefault(p => healersIds.Contains(p.Class.Id) && p != healer2 && p != healer1);
        if(healer1 != null){
            heal1Name = healer1.Name;
        }
        if(healer2 != null){
            heal2Name = healer2.Name;
        }
        if(healer3 != null){
            heal3Name = healer3.Name;
        }
        Client.NotificationManager.Show(_notice);
        Client.NotificationManager.Show(_notice1);
        Client.NotificationManager.Show(_notice2);
    }
    
    void NoticeUpdate(){
        NoticeText(healer1, heal1Name, rescd1, disable1, _notice, _MassResCoolDown1, _ResCoolDown1);
        NoticeText(healer2, heal2Name, rescd2, disable2, _notice1, _MassResCoolDown2, _ResCoolDown2);
        NoticeText(healer3, heal3Name, rescd3, disable3, _notice2, _MassResCoolDown3, _ResCoolDown3);;
        {
            int ResCoolDown = (_ResCoolDown1 - Environment.TickCount) / 1000;
            if(ResCoolDown < 1){
                rescd1 = false;
            }
        }
        {
            int ResCoolDown = (_ResCoolDown2 - Environment.TickCount) / 1000;
            if(ResCoolDown < 1){
                rescd2 = false;
            }
        }
        {
            int ResCoolDown = (_ResCoolDown3 - Environment.TickCount) / 1000;
            if(ResCoolDown < 1){
                rescd3 = false;
            }
        }
    }
    
    
    void NoticeText(L2Player healer, string healName, bool rescd, bool disable, Notification notice, int _MassRessCoolDown, int _ResCoolDown){
        
        if(healer == null){
            return;
        }
        if (HealIsDisabled(healer)) disable = true; else disable = false;
        
        string MassRes = "";
        if(MassResClasses.Contains(healer.Class.Id)){
            int MassResCoolDown = (_MassRessCoolDown - Environment.TickCount) / 1000;
            if(MassResCoolDown < 1){
                MassRes = " / Mass +";
            }
            else MassRes = String.Format("/ Mass {0} sec", MassResCoolDown);
        }
        if(rescd == false && disable == false){
            notice.Color = Color.LimeGreen;
            notice.Text = String.Format("{0}  Ready {1}", healName, MassRes);
        }
        if(rescd == true && disable == false){
            int ResCoolDown = (_ResCoolDown - Environment.TickCount) / 1000;
            notice.Color = Color.Red;
            notice.Text = String.Format("{0} => {1} sec {2}", healName, ResCoolDown, MassRes);
        }
        if(rescd == false && disable == true){
            notice.Color = Color.Red;
            notice.Text = String.Format("{0}  Disabled {1}", healName, MassRes);
        }
        if(rescd == true && disable == true){
            int ResCoolDown = (_ResCoolDown - Environment.TickCount) / 1000;
            notice.Color = Color.Red;
            notice.Text = String.Format("{0} => {1} Sec + Disabled {2}", healName, ResCoolDown, MassRes);
        }
    }
    
    void PartyCheking(){
        int[] healersIds = {105, 112, 97, 16, 43, 30};
        if(!PartyMembers.Contains(healer1) && healer1 != null){
            NoticeRestart();
        }
        if(!PartyMembers.Contains(healer2) && healer2 != null){
            NoticeRestart();
        }
        if(!PartyMembers.Contains(healer3) && healer3 != null){
            NoticeRestart();
        }
        
        if(PartyMembers.Any(p => healersIds.Contains(p.Class.Id) && healer3 == null &&
                            p != healer1 && p != healer2 && p != healer3)){
            NoticeRestart();
        }
    }


    public bool isDisabled(){
        int[] disabedIds = {1064, 437, 1246, 1336, 3074, 3078, 4215, 1381, 1169, 1092, 4689, 1375, 1376, 763, 6381, 6383, 98, /* hates: */ 18, 28, 985}; //маг сайленсы фиры
        return (Me.IsTranced || Me.IsAnchored || Me.IsMedused || Me.Buffs.Any(b => disabedIds.Contains(b.Id)));
    }

    public bool HealIsDisabled(L2Player actor){
        int[] disabedIds = {1064, 437, 1246, 1336, 3074, 3078, 4215, 1381, 1169, 1092, 4689, 1375, 1376, 763, 6381, 6383, 98, /* hates: */ 18, 28, 985}; //маг сайленсы фиры
        return (actor.IsTranced || actor.IsDead|| actor.IsAnchored || actor.IsMedused || actor.Buffs.Any(b => disabedIds.Contains(b.Id)));
    }

    public int ResCoolDown(L2Player actor, double cd){
        if(actor.Buffs.Any(b => b.Id == 1248))// Suspa
        {
            cd = cd * 3;
        }
        if(actor.Buffs.Any(b => b.Id == 4703))//Gift Serafim
        {
            cd = cd * 0.65;
        }
        if(actor.Buffs.Any(b => b.Id == 349))//Renewal
        {
            cd = cd * 0.8;
        }
        if(actor.Buffs.Any(b => b.Id == 3200 || b.Id == 3202))//Refresh
        {
            cd = cd * 0.85;
        }
        if(settings.HasNeckl.Contains(actor.Name))
        {
            cd = cd * 0.95;
        }
        return (int)cd;
        
    }

}
 

jr

Administrator
Команда форума
А это нотис на готовность своего скилла
C#:
using System;
using System.Linq;
using System.Collections.Generic;
using NewWidget.Core;
using NewWidget.Core.Native;
using NewWidget.Core.Scripting;
using NewWidget.GameData;

public class Script : ScriptBase {

    int[] SkillIds = { 1056 };
    Dictionary<int, bool> ReadySkill = new Dictionary<int, bool>{};
    
    public override void OnStart() {
        base.OnStart();
        foreach(int id in SkillIds)
            ReadySkill.Add(id, Me.SkillCooltime(id) < 300 ? true : false);
        CreateTimer(280, alarm);
        CastStarted(actor => actor == Me && SkillIds.Contains(actor.Cast.Id), actor => ReadySkill[actor.Cast.Id] = false);
        Enabled = true;
    }
    
    void alarm()
    {
        var skill = Me.Skills.FirstOrDefault(s => SkillIds.Contains(s.Id) && ReadySkill[s.Id] == false && Me.SkillCooltime(s.Id) < 300);
        if(skill != null) {
            L2Helper.PlaySound("appear.wav");
            ReadySkill[skill.Id] = true;
        }
    }

}
 

Utek

New member
может кто сделать на кд кансла у магов такой вместо масс реса и реса
 
Сверху