Google-Code-Fork / tibiaapi

Automatically exported from code.google.com/p/tibiaapi
MIT License
0 stars 0 forks source link

Saying/Casting an Unlearned Spell through Console Object causes Crash #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When trying to test my auto healer I discovered that if I tried to cast
mass healing on my Sorcerer (Expecting a poof and "You have not learned
this spell.") that it would cause my program to crash, followed by an
exception. Below is the code I used to test this with, where
cb_AutoHeal_SpellList.SelectedItem is always "Mass Healing" (the combo box
is populated from Tibia.Objects.SpellList where SpellCategory and SpellType
are healing and instant) and produced a crash each time.

Ex 1: Using String
    con.Say("exura gran mas res");

Ex 2: Using String
    SpellList findHealingSpell = new Tibia.Objects.SpellList();
    Spell cast =
findHealingSpell.FindSpell(cb_AutoHeal_SpellList.SelectedItem.ToString());
    con.Say(cast.Words.ToString());

Ex 3: Using Spell
    SpellList findHealingSpell = new Tibia.Objects.SpellList();
    Spell cast =
findHealingSpell.FindSpell(cb_AutoHeal_SpellList.SelectedItem.ToString());
    con.Spell(cast);

Original issue reported on code.google.com by hitokirixeno@gmail.com on 1 May 2008 at 11:40

GoogleCodeExporter commented 9 years ago
1. Were you using the proxy or packet.dll?
2. What is the exception?

Original comment by ian320 on 2 May 2008 at 12:18

GoogleCodeExporter commented 9 years ago
Proxy, and this is the exception thrown after the program crashes, I'm assuming 
its
from the proxy being closed once the program crashes?

************** Exception Text **************
System.IO.IOException: Unable to write data to the transport connection: An
established connection was aborted by the software in your host machine. --->
System.Net.Sockets.SocketException: An established connection was aborted by the
software in your host machine
   at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size,
SocketFlags socketFlags, AsyncCallback callback, Object state)
   at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32
size, AsyncCallback callback, Object state)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32
size, AsyncCallback callback, Object state)
   at Tibia.Util.Proxy.SendToServer(Byte[] packet)
   at Tibia.Objects.Client.Send(Byte[] packet)
   at Tibia.Objects.Console.Say(Message message)
   at Tibia.Objects.Console.Say(String text)
   at Synapsis.MainWindow.tmr_SpellCast_Tick(Object sender, EventArgs e) in
C:\Documents and Settings\Chris\My Documents\Visual Studio
2005\Projects\Synapsis\Synapsis\Form1.cs:line 178
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)

Original comment by nightwal...@gmail.com on 2 May 2008 at 2:56

GoogleCodeExporter commented 9 years ago
When you say the "program" do you mean Tibia or your program?

Original comment by ian320 on 2 May 2008 at 3:54

GoogleCodeExporter commented 9 years ago
My program, gives the nice uninformative "Program has encountered an error and 
needs
to close. We are sorry for the inconvenience." dialog window.

Original comment by nightwal...@gmail.com on 2 May 2008 at 4:46

GoogleCodeExporter commented 9 years ago
Just to clairfy, that is me, I was just on a different computer at the time.

Original comment by hitokirixeno@gmail.com on 2 May 2008 at 4:36

GoogleCodeExporter commented 9 years ago
To be honest, I have no idea why this is happening. It doesn't happen if you 
try it
with exura, or utevo lux, but with exura gran mas res and exura vita it 
crashes, for
some reason the server closes the connection.

If we could get a second opinion on the matter that would be great.

Original comment by ian320 on 5 May 2008 at 3:17

GoogleCodeExporter commented 9 years ago
So it is happening to you as well?

Original comment by hitokirixeno@gmail.com on 5 May 2008 at 3:21

GoogleCodeExporter commented 9 years ago
Yes, it happens to me as well. For now I would just try to avoid doing that ;).

Original comment by ian320 on 5 May 2008 at 3:26

GoogleCodeExporter commented 9 years ago
In XTEA change this:
byte[] packetprep = new byte[packet.Length + (8 - pad)];

for this:
byte[] packetprep;

if(pad == 0)
   packetprep = new byte[packet.Length];
else
   packetprep = new byte[packet.Length + (8 - pad)];

Cya

Original comment by brunodun...@gmail.com on 16 Sep 2008 at 7:11

GoogleCodeExporter commented 9 years ago
brunodunbar: thanks for noticing that, of course we must check for zero!

Fixed in r403.

Needs to be verified!

Original comment by ian320 on 16 Sep 2008 at 2:05