i am trying out some simple code to cast consecrate weapon but I keep getting disconnected after the second cast of the spell with the message "Duplicates are not allowed"
The call stack shows
An exception raised at 23:33:40:611
Duplicates not allowed
(00882C80){Stealth.exe } [00C83C80] ClassCharacter.{System.Generics.Collections}TDictionary<System.Word,ScriptTypes.TBuffIcon>.Add (Line 1846, "System.Generics.Collections.pas")
Call stack:
(00882C7B){Stealth.exe } [00C83C7B] ClassCharacter.{System.Generics.Collections}TDictionary<System.Word,ScriptTypes.TBuffIcon>.Add (Line 1844, "System.Generics.Collections.pas")
(008794F9){Stealth.exe } [00C7A4F9] ClassCharacter.TCharacter.GetInfoFromPacket_0xDF (Line 10422, "ClassCharacter.pas")
(0086DA48){Stealth.exe } [00C6EA48] ClassCharacter.TCharacter.RedirectGamePacket (Line 6457, "ClassCharacter.pas")
(0086BF8E){Stealth.exe } [00C6CF8E] ClassCharacter.TCharacter.GameClientOnRead (Line 5863, "ClassCharacter.pas")
(002CCE91){Stealth.exe } [006CDE91] System.Win.ScktComp.TCustomSocket.Event (Line 1903, "System.Win.ScktComp.pas")
(002CB42E){Stealth.exe } [006CC42E] System.Win.ScktComp.TCustomWinSocket.Event (Line 1013, "System.Win.ScktComp.pas")
(002CBA09){Stealth.exe } [006CCA09] System.Win.ScktComp.TCustomWinSocket.WndProc (Line 1201, "System.Win.ScktComp.pas")
(000D5CAC){Stealth.exe } [004D6CAC] System.Classes.StdWndProc (Line 16600, "System.Classes.pas")
Here's my code but I cant figure out whats wrong
class Program
{
static void Main(string[] args)
{
PlayerMobile player = PlayerMobile.GetPlayer();
int hp = player.Hits;
var spellname = string.Empty;
var delay = 0;
do
{
if (player.WarMode)
{
if (player.Mana > 35 && hp > 35)
{
spellname = "Consecrate Weapon";
player.Cast(spellname);
delay = 4000;
Stealth.Client.Wait(delay);
}
}
} while (!player.Dead);
}
}