Salut , alors que je mataquait a la partie "farm" de mon bot (pluto de euubot) je bloque totalement , enfaite je récupert bien la resource que je veut je me déplace dessu mai quand je veut la récolter sa fait rien Oo je comprent vraiment pas (pour utiliser la resource une fois que je suit dessu j'utilise un truque comme sa
InteractiveUseRequestMessage pack = new InteractiveUseRequestMessage(_resLst[_tempIndex].Interactive.ElementId, _resLst[_tempIndex].Interactive.EnabledSkills[0].SkillInstanceUid);
_host.SendToServer(pack);
juste aprés avoire recu le "BasicNoOperationMessage"
voici le code de mon module
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EuuBot.Relay.Plugins.Maps;
using EuuBot.Packets.Game.Interactive;
using EuuBot.Packets.Game.Context.Roleplay;
using EuuBot.Packets;
using EuuBot.Relay.PluginInterfaces.Host;
using EuuBot.Data.Game.Interactive;
namespace EuuBot.Relay.Plugins.Farme
{
class Farm
{
private IPluginHost _host;
private List<FarmResource> _resLst;
private bool _farming = false;
private bool _moving = false;
private int _tempIndex = 0;
private List<int> _SlillsList;
public Farm(IPluginHost host)
{
_host = host;
_resLst = new List<FarmResource>();
}
public void ProcessPacket(ServerPacket packet)
{
switch (packet.PacketType)
{
case ServerPacketType.MapComplementaryInformationsDataMessage:
UpdateMap((MapComplementaryInformationsDataMessage)packet);
break;
case ServerPacketType.InteractiveElementUpdatedMessage:
InteractiveElementUpdatedMessage mes = (InteractiveElementUpdatedMessage)packet;
if (mes.InteractiveElement.ElementId == _resLst[_tempIndex].Interactive.ElementId)
{
_resLst[_tempIndex].Interactive = mes.InteractiveElement;
if (_farming == true)
{
FindRes();
}
}
break;
case ServerPacketType.BasicNoOperationMessage:
if (_moving==true)
{
EndMoving();
GetCurrentRes();
}
break;
}
}
private void GetCurrentRes()
{
//_host.GetPlugin<Interactive.InteractivePlugin>().UseInteractiveElement(_resLst[_tempIndex].Interactive);
InteractiveUseRequestMessage pack = new InteractiveUseRequestMessage(_resLst[_tempIndex].Interactive.ElementId, _resLst[_tempIndex].Interactive.EnabledSkills[0].SkillInstanceUid);
_host.SendToServer(pack);
}
private void FindRes()
{
for (int i = 0; i < _SlillsList.Count; i++)
{
for (int ii = 0; i < _resLst.Count-1; ii++)
{
FarmResource res = _resLst[ii];
if (res.Interactive.EnabledSkills.Count > 0)
{
if (res.Interactive.EnabledSkills[0].SkillId == _SlillsList)
{
_tempIndex = ii;
StartMoving(res.Stated.ElementCellId);
break;
}
}
}
}
}
public void SetSkillsList(List<int> SkillIdLst)
{
_SlillsList = SkillIdLst;
}
public void StartFarming()
{
_farming = true;
FindRes();
}
public void StopFaming()
{
_farming = false;
}
private void EndMoving()
{
_moving = false;
}
private void StartMoving(short cellId)
{
_host.GetPlugin<Maps.MovementPlugin>().GoTo(cellId);
_moving = true;
}
private void UpdateMap(MapComplementaryInformationsDataMessage packet)
{
foreach (InteractiveElement elem in packet.InteractiveElements)
{
foreach (StatedElement elems in packet.StatedElements)
{
if (elem.ElementId == elems.ElementId)
{
FarmResource newRes = new FarmResource();
newRes.Interactive = elem;
newRes.Stated = elems;
_resLst.Add(newRes);
}
}
}
}
}
}
Et le code du plugin
using EuuBot.Packets;
using EuuBot.Relay.PluginInterfaces;
using EuuBot.Relay.PluginInterfaces.Host;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EuuBot.Packets.Game.Context.Roleplay;
using EuuBot.Data.Game.Interactive;
namespace EuuBot.Relay.Plugins.Farme
{
[PluginInformation("Farm Plugin","Permet de récolter de resource sur la map","","1.0.0")]
class FarmPlugin : IConnectionPlugin,IFormPlugin
{
private FrmFarme _frm;
public Farm _farm;
private IPluginHost _host;
private List<FarmResource> _resLst;
public bool ForceAutoLoad
{
get { return false; }
}
public PacketAction ProcessClientPacket(ClientPacket packet)
{
switch (packet.PacketType)
{
case ClientPacketType.InteractiveUseRequestMessage:
break;
}
return PacketAction.Keep;
}
public PacketAction ProcessServerPacket(ServerPacket packet)
{
_farm.ProcessPacket(packet);
return PacketAction.Keep;
}
public void Initiate(IPluginHost host)
{
_farm = new Farm(host);
_host = host;
}
public void Dispose()
{
}
public System.Windows.Forms.Form GetPluginForm()
{
if (_frm == null)
_frm = new FrmFarme(_host);
return _frm;
}
}
}
et au cas ou le code de la class FarmeRessource
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EuuBot.Data.Game.Interactive;
namespace EuuBot.Relay.Plugins.Farme
{
class FarmResource
{
private StatedElement _stated;
private InteractiveElement _interactive;
public StatedElement Stated
{
get
{
return _stated;
}
set
{
_stated = value;
}
}
public InteractiveElement Interactive
{
get
{
return _interactive;
}
set
{
_interactive = value;
}
}
}
}
"FarmeResource"
et pour utiliser tout sa je fait
List<int> SkillList = new List<int>();
SkillList.Add(45);
_host.GetPlugin<FarmPlugin>()._farm.SetSkillsList(SkillList);
_host.GetPlugin<FarmPlugin>()._farm.StartFarming();
et une autre petite question, la liste des resource (arbre ble ext) c'est dans les d2o ou faut tout se taper a la main?
Ps. Sinnon trouvez vous que ma facon de programmer et convenable? car je débute en c# et je suit pas sur d'avoire une trés bonne architécture