private void Run() { Api = new Server.Script.Api(); var servers = Api.Login("test", "123456"); var characters = Api.SelectServer(servers.First()); Api.SelectPlayer(characters.Single(p => p.Name == "scavenger")); Api.ChatMessage += OnChatMessage; Api.CreatureUpdate += OnCreatureUpdate; Api.QuestionAsked += OnQuestionAsked; Api.SkillReused += OnSkillReused; Api.StartMoving += OnMoving; Api.FinishMoving += OnMoving; Api.Die += OnDie; while (Api.State > Server.Script.State.NotConnected) { lock (Api.Sync) { Api.DoEvents(); Api.Wait(r => true); } } }
public Player(string file) { Logger = NLog.LogManager.GetCurrentClassLogger(); Memory = new L2Apf.Memory(file); Api = new Server.Script.Api() { Config = new Model.LoginServer() { Address = Memory.Config.Address, Port = Memory.Config.Port, Protocol = Memory.Config.Protocol, Token = Memory.Config.Token } }; Ai = new Ai._Blob(Api, Memory); }
private void Run() { Api = new Server.Script.Api(); var servers = Api.Login("test", "123456"); var characters = Api.SelectServer(servers.First()); Api.SelectPlayer(characters.Single(p => p.Name == "scavenger")); Api.ChatMessage += OnChatMessage; Api.CreatureUpdate += OnCreatureUpdate; Api.QuestionAsked += OnQuestionAsked; Api.SkillReused += OnSkillReused; Api.StartMoving += OnMoving; Api.FinishMoving += OnMoving; Api.Die += OnDie; while (Api.State > Server.Script.State.NotConnected) lock (Api.Sync) { Api.DoEvents(); Api.Wait(r => true); } }