Bonsoir,
le scripting avance enfin !
J'ai réussi à mettre en place un bon début de système de script.
Voici à quoi ressemble le Gestionnaire de Scripts:
Cliquez pour révéler
Cliquez pour masquer
Loading Image
On a la possibilité d'importer un fichier .cs qui sera déplacé dans le dossier script du projet.
Chaque script est relié à un fichier xml, qui se présente sous cette forme:
<Script>
<script ScriptName="GatherScript.cs" />
<script Author="BlueDream" />
<script Description="Gather Script v1" />
</Script>
On a la possibilité de débugger un script directement depuis le gestionnaire, ce qui permet de savoir si le script contient ou non des erreurs.
Cliquez pour révéler
Cliquez pour masquer
Loading Image
Voici a quoi ressemble mon script de récolte par exemple:
Cliquez pour révéler
Cliquez pour masquer
using System;
using System.Linq;
using System.Collections.Generic;
using AmaknaCore.Debug.Client;
using AmaknaCore.Debug.Client.Action.Gather;
using AmaknaCore.Debug.Game.Movement.Enums;
using AmaknaCore.Debug.Client.Network;
public class GatherScript
{
#region Variables
private MainClient Client;
private bool Running;
private List<int> InteractivesTypeId = new List<int>() { 38 }; // Blé
#endregion
#region Builder
public GatherScript(MainClient client)
{
Client = client;
Running = false;
}
#endregion
#region Script
public void LoadScript()
{
// Load Events
Client.Action.Gather.NoInteractiveAvailable_Event += NoInteractiveAvailable_Event;
Client.Network.Connected_Event += Connected;
Client.Network.Disconnected_Event += Disconnected;
// Log
Client.Interface.Logger.Info(string.Format("Gather Script Loaded."));
}
public void UnLoadScript()
{
// Unload Events
Client.Action.Gather.NoInteractiveAvailable_Event -= NoInteractiveAvailable_Event;
Client.Network.Connected_Event -= Connected;
Client.Network.Disconnected_Event -= Disconnected;
// Log
Client.Interface.Logger.Info(string.Format("Gather Script Unloaded."));
}
public void StartScript()
{
if(Running == true)
return;
Running = true;
Client.Action.Gather.StartGather(InteractivesTypeId);
}
public void StopScript()
{
if(Running == false)
return;
Running = false;
Client.Action.Gather.StopGather();
}
#endregion
#region Events
private void NoInteractiveAvailable_Event(object sender, GatherAction.NoInteractiveAvailableEventsArgs e)
{
if(Running == false)
return;
}
private void Connected(object sender, ClientNetwork.ConnectedEventArgs e)
{
if(Running == false)
return;
Client.Action.Gather.StartGather(InteractivesTypeId);
}
private void Disconnected(object sender, ClientNetwork.DisconnectedEventArgs e)
{
if(Running == false)
return;
Client.Action.Gather.StopGather();
}
#endregion
}
Il ne fait rien d'autre que récolter des ressources sur la map.
Je vais m'occuper du WorldPathfinding et de l'intéraction avec les NPC afin de lui faire faire un retour en banque.
L'api se présente sous cette forme: (Je ne développe pas j'en aurais pour la journée)
Cliquez pour révéler
Cliquez pour masquer
-> ClientInterface Interface
-> ClientInformations Informations
-> ClientNetwork Network
-> ClientData Data
- AccountInformations Account
- ServersList Servers
- PlayedCharacter PlayedCharacter
- CharactersList Characters
- Map Map
- ClientStateEnum State
-> ClientAction Action
-> ClientPhaseEnum Phase
Pour les actions en jeu, il faut accéder au Dossier 'Game', qui contient des classes static permettant d'intérragir avec le jeu.
Cliquez pour révéler
Cliquez pour masquer
-> Game.Interactive.InteractiveManager
-> Game.Inventory.InventoryManager
-> Game.Movement.MovementManager
-> Game.Stats.StatsManager
Qu'en pensez-vous ?