1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Xanthos Evo System

Discussion in 'Script Support' started by cmileto, Dec 8, 2013.

  1. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
    adding this to our shard on request of my oldest son.

    Trying to compile gives me:

    Error478 Cannot implicitly convert type 'System.DateTime' to 'long' /home/clayton/projects/ServUOpub54/Scripts/Customs/Clayton/Xanthos/EVO/System/Mercenary/Mercenary.cs line:447


    Here is the script:
    Code (C#):
    1.  
    2. #region Header
    3. // EvoSystem version 2.1, by Xanthos
    4. // Mercenary is based on a concept by Raelis, Sadoul and Grae
    5. //
    6. // freshened up and added
    7. // by clayton @ dec 07 2013
    8. // http://ninja.wvgeeks.com
    9. #endregion Header
    10. using System;
    11. using Server;
    12. using Server.Items;
    13. using Server.Mobiles;
    14. using Server.Network;
    15. using Server.Misc;
    16. using Server.SkillHandlers;
    17. using System.Collections;
    18. using System.Collections.Generic;
    19. using Server.Targeting;
    20. using Xanthos.Utilities;
    21. using Xanthos.Interfaces;
    22. namespace Xanthos.Evo
    23. {
    24. [CorpseName( "a mercenary corpse" )]
    25. public class Mercenary : BaseEvo, IEvoCreature
    26. {
    27. [CommandProperty( AccessLevel.Administrator )]
    28. public new bool CanHue
    29. {
    30. get { return false; }
    31. }
    32. private static Hashtable s_Keywords;
    33. private static string s_Version = "EvoSystem version 2.1, by Xanthos";
    34. public override BaseEvoSpec GetEvoSpec()
    35. {
    36. return MercenarySpec.Instance;
    37. }
    38. public override BaseEvoEgg GetEvoEgg()
    39. {
    40. return null;
    41. }
    42. public override bool AddPointsOnDamage { get { return false; } }
    43. public override bool AddPointsOnMelee { get { return true; } }
    44. public override Type GetEvoDustType() { return null; }
    45. enum Commands { None = 0, Restyle, Dress, Undress, Mount, Dismount, Stats, Unload, List, Arm, Grab, Loot, Attack, Tithe, Help, WhosYourDaddy, Last = Commands.WhosYourDaddy, }
    46. static Mercenary()
    47. {
    48. string [] keyWords = { " ", "restyle", "dress", "undress", "mount", "dismount", "stats", "unload", "list", "arm", "grab", "loot", "attack", "tithe", "help", "whosyourdaddy" };
    49. s_Keywords = new Hashtable( keyWords.Length, StringComparer.OrdinalIgnoreCase );
    50. for ( int i = 0; i < keyWords.Length; ++i )
    51. s_Keywords[keyWords[i]] = i;
    52. }
    53. public Mercenary( string name ) : base( name, AIType.AI_Melee, 0.01 )
    54. {
    55. SpeechHue = Utility.RandomDyedHue();
    56. Hue = Utility.RandomSkinHue();
    57. Item hair = new Item( Utility.RandomList( 0x203B, 0x2049, 0x2048, 0x204A ) );
    58. hair.Hue = Utility.RandomNondyedHue();
    59. hair.Layer = Layer.Hair;
    60. hair.Movable = false;
    61. AddItem( hair );
    62. if ( Female = Utility.RandomBool() )
    63. Body = 0x191;
    64. else
    65. {
    66. Body = 0x190;
    67. if ( Utility.RandomBool() )
    68. {
    69. Item beard = new Item( Utility.RandomList( 0x203E, 0x203F, 0x2040, 0x2041, 0x204B, 0x204C, 0x204D ) );
    70. beard.Hue = hair.Hue;
    71. beard.Layer = Layer.FacialHair;
    72. beard.Movable = false;
    73. AddItem( beard );
    74. }
    75. }
    76. if ( !(this is IEvoGuardian) )
    77. {
    78. Item weapon;
    79. switch ( Utility.Random( 6 ) )
    80. {
    81. case 0: weapon = new Kryss(); break;
    82. case 1: weapon = new Scimitar(); break;
    83. case 2: weapon = new WarAxe(); break;
    84. case 3: weapon = new Cutlass(); break;
    85. case 4: weapon = new HammerPick(); break;
    86. default: weapon = new WarFork(); break;
    87. }
    88. AddItem( weapon );
    89. AddItem( new Robe() );
    90. }
    91. if ( null == Backpack )
    92. {
    93. Container pack = new Backpack();
    94. pack.Movable = false;
    95. AddItem( pack );
    96. }
    97. }
    98. public Mercenary( Serial serial ) : base( serial ) {}
    99. public override FoodType FavoriteFood{ get{ return FoodType.Eggs | FoodType.Fish | FoodType.Meat | FoodType.FruitsAndVegies; } }
    100. protected override void PackSpecialItem()
    101. {
    102. Item item;
    103. switch ( Utility.Random( 4 ) )
    104. {
    105. case 0: item = (Item)new MercenaryDeed(); break;
    106. case 1: item = (Item)new EtherealLlama(); break;
    107. case 3: item = (Item)new HoodedShroudOfShadows(); break;
    108. default: ((BallOfSummoning)(item = (Item)new BallOfSummoning())).Charges = 2000; break;
    109. }
    110. item.LootType = LootType.Blessed;
    111. PackItem( item );
    112. }
    113. protected override void Evolve( bool hatching )
    114. {
    115. base.Evolve( hatching );
    116. InvalidateProperties();
    117. }
    118.  
    119. public override string ApplyNameSuffix( string suffix )
    120. {
    121. if ( !IsBonded )
    122. return "";
    123. MercenarySpec spec = GetEvoSpec() as MercenarySpec;
    124. if ( null != spec && null != spec.Stages )
    125. {
    126. if ( suffix.Length == 0 )
    127. suffix = GetMercTitle( spec, m_Stage );
    128. else
    129. suffix = String.Concat( suffix, " ", GetMercTitle( spec, m_Stage ) );
    130. }
    131. return base.ApplyNameSuffix( suffix );
    132. }
    133. private string GetMercTitle( MercenarySpec spec, int stage )
    134. {
    135. string title = "";
    136. if ( 0 <= m_Stage && m_FinalStage >= m_Stage )
    137. {
    138. if ( stage == m_FinalStage || stage == m_FinalStage - 1 )
    139. title = ", " + spec.Stages[ stage ].Title + " of " + ControlMaster.Name;
    140. else
    141. title = spec.Stages[ stage ].Title;
    142. }
    143. return title;
    144. }
    145. private string GetRestrictedUseTitle( bool isArtifact )
    146. {
    147. MercenarySpec spec = GetEvoSpec() as MercenarySpec;
    148. return null == spec || null == spec.Stages ? "a higher" : GetMercTitle( spec, isArtifact ? spec.ArtifactStage : spec.CraftedWeaponStage );
    149. }
    150. private bool CanUseRestrictedItem( bool isArtifact )
    151. {
    152. MercenarySpec spec = GetEvoSpec() as MercenarySpec;
    153. return ( null != spec && ( isArtifact ? spec.ArtifactStage : spec.CraftedWeaponStage ) <= m_Stage );
    154. }
    155. public override bool HandlesOnSpeech( Mobile from ) { return true; }
    156. public override void OnSpeech( SpeechEventArgs e )
    157. {
    158. Mobile from = e.Mobile;
    159. if ( ControlMaster != from || IsDeadPet )
    160. {
    161. base.OnSpeech( e );
    162. return;
    163. }
    164. object command = Commands.None;
    165. if ( e.Speech.Length > "all ".Length && e.Speech.Substring( 0, "all ".Length ).ToLower() == "all " )
    166. command = s_Keywords[ e.Speech.Substring( "all ".Length ) ];
    167. else if ( e.Speech.Length > Name.Length + 1 && e.Speech.Substring( 0, Name.Length + 1 ).ToLower() == Name.ToLower() + ' ' )
    168. command = s_Keywords[ e.Speech.Substring( Name.Length + 1 ) ];
    169. switch ( (command == null ? (int)Commands.None : (int)command) )
    170. {
    171. case (int)Commands.Restyle:
    172. from.SendGump( new Xanthos.Evo.HairstylistBuyGump( from, this ) );
    173. break;
    174. case (int)Commands.Dress:
    175. Say("I shall attmept to equip all the items in my pack.");
    176. {
    177. List<Server.Item> items = Backpack.Items;
    178.  
    179. for ( int i = items.Count - 1; i >= 0; --i )
    180. {
    181. Item item = (Item)items[i];
    182. if ( item is BaseWeapon || item is BaseClothing || item is BaseArmor || item is BaseJewel )
    183. {
    184. Backpack.DropItem( item );
    185. OnDragDrop( from, item );
    186. }
    187. }
    188. }
    189. break;
    190. case (int)Commands.Undress:
    191. Say("I shall give you everything I am wearing.");
    192. {
    193. List<Server.Item> items = Items;
    194.  
    195. for ( int i = items.Count - 1; i >= 0; --i )
    196. {
    197. Item item = (Item)items[i];
    198. if ( !(item is Container || item is IMountItem) && item.Layer != Layer.FacialHair && item.Layer != Layer.Hair )
    199. from.AddToBackpack( item );
    200. }
    201. }
    202. break;
    203. case (int)Commands.Mount:
    204. if ( null == Mount )
    205. {
    206. IMount mount = FindMyMount( Backpack );
    207. if ( null == mount )
    208. from.Target = new MountTarget( from, this );
    209. else
    210. mount.Rider = this;
    211. }
    212. break;
    213. case (int)Commands.Dismount:
    214. if ( null != Mount )
    215. {
    216. IMount mount = FindMyMount( null );
    217. if ( null != mount )
    218. {
    219. mount.Rider = null;
    220. if ( mount is EtherealMount )
    221. Backpack.DropItem( mount as EtherealMount );
    222. else
    223. ((BaseMount)mount).ControlOrder = OrderType.Follow;
    224. }
    225. }
    226. break;
    227. case (int)Commands.Stats:
    228. from.SendGump( new AnimalLoreGump( this ) );
    229. break;
    230. case (int)Commands.Unload:
    231. Say("I shall give you everything in my pack.");
    232. {
    233. List<Server.Item> items = Backpack.Items;
    234.  
    235. for ( int i = items.Count - 1; i >= 0; --i )
    236. {
    237. from.AddToBackpack( (Item)items[i] );
    238. }
    239. }
    240. break;
    241. case (int)Commands.List:
    242. Say("I am carrying:");
    243. foreach( Item item in Backpack.Items )
    244. {
    245. if ( null != item )
    246. Say( "{0} {1}", item.Amount, item.GetType().Name );
    247. }
    248. break;
    249. case (int)Commands.Arm:
    250. {
    251. Item item = Backpack.FindItemByType( typeof( BaseWeapon ) );
    252. if ( null == item )
    253. Say( "I have no weapons to arm myself with." );
    254. else
    255. {
    256. Backpack.DropItem( item );
    257. OnDragDrop( from, item );
    258. }
    259. }
    260. break;
    261. case (int)Commands.Grab:
    262. GrabItems( false );
    263. break;
    264. case (int)Commands.Loot:
    265. GrabItems( true );
    266. break;
    267. case (int)Commands.Tithe:
    268. {
    269. bool ankhInRange = false;
    270. foreach ( Item item in GetItemsInRange( 2 ) )
    271. {
    272. if ( item is AnkhNorth || item is AnkhWest )
    273. {
    274. ankhInRange = true;
    275. break;
    276. }
    277. }
    278. if ( !ankhInRange )
    279. Say( "I must be near a shrine to tithe." );
    280. else
    281. {
    282. Container pack = Backpack;
    283. if ( null != pack )
    284. {
    285. Item item = pack.FindItemByType( typeof( Gold ) );
    286. int tithe;
    287. if ( null != item && item.Amount > 0 && pack.ConsumeTotal( typeof( Gold ), (tithe = item.Amount) ))
    288. {
    289. Emote( "*Tithes gold as a sign of devotion.*" );
    290. TithingPoints += tithe;
    291. PlaySound( 0x243 );
    292. PlaySound( 0x2E6 );
    293. }
    294. Say( "I now have {0} tithing points.", TithingPoints );
    295. }
    296. }
    297. }
    298. break;
    299. case (int)Commands.Help:
    300. Say("I will follow these commands: restyle, dress, undress, mount, dismount, unload, list, arm, grab, loot, attack, tithe and stats.");
    301. break;
    302. case (int)Commands.WhosYourDaddy:
    303. Say( s_Version );
    304. break;
    305. case (int)Commands.Attack:
    306. switch ( Utility.Random( 3 ) )
    307. {
    308. case 0: WeaponAbility.SetCurrentAbility( this, ((BaseWeapon)Weapon).PrimaryAbility ); break;
    309. case 1: WeaponAbility.SetCurrentAbility( this, ((BaseWeapon)Weapon).SecondaryAbility ); break;
    310. case 2: new Server.Spells.Chivalry.ConsecrateWeaponSpell( this, null ).Cast(); break;
    311. }
    312. goto default;
    313. default:
    314. base.OnSpeech( e );
    315. return;
    316. }
    317. e.Handled = true;
    318. }
    319. public override void OnThink()
    320. {
    321. base.OnThink();
    322. if ( Hits < HitsMax - 100 && null == BandageContext.GetContext( this ))
    323. {
    324. Item item = Backpack.FindItemByType( typeof(Bandage) );
    325. if ( null != item && null != BandageContext.BeginHeal( this , this ))
    326. item.Consume( 1 );
    327. }
    328. if ( Hunger < 10 || Loyalty <= BaseCreature.MaxLoyalty / 10 )
    329. {
    330. CheckFeedSelf();
    331. }
    332. }
    333. private void CheckFeedSelf()
    334. {
    335. if ( !IsDeadPet && null != Backpack )
    336. {
    337. Item item = Backpack.FindItemByType( typeof( Food ) );
    338. if ( null == item )
    339. return;
    340. ((Food)item).Eat( this ); Stam += 15;
    341. if ( Loyalty < BaseCreature.MaxLoyalty && 0.5 >= Utility.RandomDouble() )
    342. {
    343. ++Loyalty;
    344. this.Emote( "*Looks happier.*" );
    345. if ( IsBondable && !IsBonded )
    346. {
    347. Mobile master = ControlMaster;
    348. if ( master != null && master.Skills[SkillName.AnimalTaming].Value >= MinTameSkill )
    349. {
    350. if ( BondingBegin == DateTime.MinValue )
    351. {
    352. BondingBegin = DateTime.Now;
    353. }
    354. else if ( (BondingBegin + BondingDelay) <= DateTime.Now )
    355. {
    356. IsBonded = true;
    357. BondingBegin = DateTime.MinValue;
    358. master.SendLocalizedMessage( 1049666 ); // Your pet has bonded with you!
    359. InvalidateProperties();
    360. }
    361. }
    362. }
    363. }
    364. }
    365. }
    366. public void GrabItems( bool ignoreNoteriety )
    367. {
    368. ArrayList items = new ArrayList();
    369. bool rejected = false;
    370. bool lootAdded = false;
    371. Emote( "*Rummages through items on the ground.*" );
    372. foreach ( Item item in GetItemsInRange( 2 ) )
    373. {
    374. if ( item.Movable )
    375. items.Add( item );
    376. else if ( item is Corpse )
    377. { // Either criminally loot any corpses or loot only corpses that we have rights to
    378. if ( ignoreNoteriety || NotorietyHandlers.CorpseNotoriety( this, (Corpse)item ) != Notoriety.Innocent )
    379. {
    380. Emote( "*Rummages through items in a corpse.*" );
    381. foreach ( Item corpseItem in ((Corpse)item).Items )
    382. items.Add( corpseItem );
    383. }
    384. }
    385. }
    386. foreach ( Item item in items )
    387. {
    388. if ( !Backpack.CheckHold( this, item, false, true ) )
    389. rejected = true;
    390. else
    391. {
    392. bool isRejected;
    393. LRReason reason;
    394. NextActionTime = DateTime.Now;
    395. Lift( item, item.Amount, out isRejected, out reason );
    396. if ( !isRejected )
    397. {
    398. Drop( this, Point3D.Zero );
    399. lootAdded = true;
    400. }
    401. else
    402. {
    403. rejected = true;
    404. }
    405. }
    406. }
    407. if ( lootAdded )
    408. PlaySound( 0x2E6 ); //drop gold sound
    409. if ( rejected )
    410. Say( "I could not pick up all of the items." );
    411. }
    412. public override bool CheckGold( Mobile from, Item dropped )
    413. {
    414. if ( dropped is Gold )
    415. return false;
    416. return base.CheckGold( from, dropped );
    417. }
    418. public IMount FindMyMount( Container pack )
    419. {
    420. List<Server.Item> items = ( null == pack ) ? Items : pack.Items;
    421. foreach ( Item item in items )
    422. {
    423. if ( item is IMountItem )
    424. return ((IMountItem)item).Mount;
    425. else if ( item.Layer == Layer.Mount )
    426. return (IMount)item;
    427. }
    428. return null;
    429. }
    430. public override bool OnDragDrop( Mobile from, Item dropped )
    431. {
    432. Item itemEquipped;
    433. if (( ControlMaster != from && this != from ) || IsDeadPet )
    434. return base.OnDragDrop( from, dropped );
    435. bool isArtifact = Xanthos.Utilities.Misc.IsArtifact( dropped );
    436. if ( ( Xanthos.Utilities.Misc.IsPlayerConstructed( dropped ) || isArtifact ) && !CanUseRestrictedItem( isArtifact ) )
    437. {
    438. from.SendMessage( Name + " must attain {0} level to equip {1} items.", GetRestrictedUseTitle( isArtifact ), isArtifact ? "artifact" : "crafted" );
    439. from.AddToBackpack( dropped );
    440. return false;
    441. }
    442. if ( dropped is Bandage || dropped is Food )
    443. {
    444. Backpack.DropItem( dropped );
    445. from.SendMessage( "You give " + Name + " supplies." );
    446. return true;
    447. }
    448. else if ( dropped is Gold )
    449. {
    450. Backpack.DropItem( dropped );
    451. from.SendMessage( "You give " + Name + " gold." );
    452. return true;
    453. }
    454. else if ( dropped is BaseWeapon )
    455. {
    456. itemEquipped = FindItemOnLayer( Layer.TwoHanded );
    457. if ( null != itemEquipped && ((BaseWeapon)dropped).CheckConflictingLayer( this, itemEquipped, Layer.TwoHanded ))
    458. from.AddToBackpack( itemEquipped );
    459. itemEquipped = FindItemOnLayer( Layer.OneHanded );
    460. if ( null != itemEquipped && ((BaseWeapon)dropped).CheckConflictingLayer( this, itemEquipped, Layer.OneHanded ))
    461. from.AddToBackpack( itemEquipped );
    462. itemEquipped = FindItemOnLayer( Layer.FirstValid );
    463. if ( null != itemEquipped && ((BaseWeapon)dropped).CheckConflictingLayer( this, itemEquipped, Layer.FirstValid ))
    464. from.AddToBackpack( itemEquipped );
    465. Backpack.DropItem( dropped );
    466. AddItem( dropped );
    467. from.SendMessage( "You give " + Name + " a weapon." );
    468. return true;
    469. }
    470. else if ( dropped is BaseArmor )
    471. {
    472. BaseArmor armor = (BaseArmor)dropped;
    473. if ( !armor.AllowMaleWearer && Body.IsMale )
    474. {
    475. from.SendLocalizedMessage( 1010388 ); // Only females can wear this.
    476. from.AddToBackpack( armor );
    477. }
    478. else if ( !armor.AllowFemaleWearer && Body.IsFemale )
    479. {
    480. from.SendMessage( "Only males can wear this." );
    481. from.AddToBackpack( armor );
    482. }
    483. else
    484. {
    485. itemEquipped = FindItemOnLayer( dropped.Layer );
    486. if ( null != itemEquipped )
    487. from.AddToBackpack( itemEquipped );
    488. Backpack.DropItem( dropped );
    489. AddItem( dropped );
    490. from.SendMessage( "You give " + Name + " armor." );
    491. return true;
    492. }
    493. }
    494. else if ( dropped is BaseClothing || dropped is BaseJewel )
    495. {
    496. if ( null != ( itemEquipped = FindItemOnLayer( dropped.Layer ) ))
    497. from.AddToBackpack( itemEquipped );
    498. Backpack.DropItem( dropped );
    499. AddItem( dropped );
    500. from.SendMessage( "You give " + Name + (dropped is BaseJewel ? " jewelry." : " clothing.") );
    501. return true;
    502. }
    503. return base.OnDragDrop( from, dropped );
    504. }
    505. private bool HasRangedEquipped()
    506. {
    507. Item item = FindItemOnLayer( Layer.TwoHanded );
    508. return ( item != null && item is BaseRanged );
    509. }
    510. public override void OnItemAdded( Item item )
    511. {
    512. base.OnItemAdded( item );
    513. if ( item is BaseRanged )
    514. {
    515. ChangeAIType( AIType.AI_Archer );
    516. }
    517. }
    518. public override void OnItemRemoved( Item item )
    519. {
    520. base.OnItemRemoved( item );
    521. if ( item is BaseRanged )
    522. {
    523. ChangeAIToDefault();
    524. }
    525. }
    526. public override void Serialize( GenericWriter writer )
    527. {
    528. base.Serialize(writer);
    529. writer.Write( (int)0 );
    530. }
    531. public override void Deserialize(GenericReader reader)
    532. {
    533. base.Deserialize(reader);
    534. int version = reader.ReadInt();
    535. if ( HasRangedEquipped() )
    536. ChangeAIType( AIType.AI_Archer );
    537. }
    538. }
    539. internal class MountTarget : Target
    540. {
    541. private Mercenary m_Merc;
    542. public MountTarget( Mobile from, Mercenary merc ) : base( 1, false, TargetFlags.None )
    543. {
    544. m_Merc = merc;
    545. from.SendMessage( "Choose a mount for " + m_Merc.Name + " to ride." );
    546. }
    547. protected override void OnTarget( Mobile from, object obj )
    548. {
    549. DoOnTarget( from, obj, m_Merc );
    550. }
    551. public static void DoOnTarget( Mobile from, object o, Mercenary merc )
    552. {
    553. EtherealMount ethy = o as EtherealMount;
    554. if ( null != ethy )
    555. {
    556. if ( null != ethy.Rider )
    557. from.SendMessage( "This ethereal mount is already in use by someone else." );
    558. else if ( !ethy.IsChildOf( from.Backpack ) )
    559. from.SendMessage( "The ethereal mount must be in your pack for you to use it." );
    560. else
    561. ethy.Rider = merc;
    562. }
    563. else
    564. {
    565. BaseMount mount = o as BaseMount;
    566. if ( null == mount )
    567. from.SendMessage( "That is not a mount." );
    568. else if ( null != mount.Rider )
    569. from.SendMessage( "This mount is already in use by someone else." );
    570. else if ( mount.ControlMaster != from )
    571. from.SendMessage( "You do not own this mount." );
    572. else
    573. mount.Rider = merc;
    574. }
    575. }
    576. }
    577. }
    The problem is with this line:

    NextActionTime = DateTime.Now;

    I have attached the rest of the system in case you would like to have it.
     

    Attached Files:

  2. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    Change DateTime.Now to DateTime.NowUtc
     
  3. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
    i did that before. But it then gives:

    Error 478 'System.DateTime' does not contain a definition for 'NowUtc'

    So I had put it back
     
  4. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    Sorry, DateTime.UtcNow
     
  5. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
    That leads to this one
    Error 483 'System.DateTime' does not contain a definition for 'NowUtc'

    Sorry to be a pain
     
  6. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    Erm...then you didn't change it to UtcNow?
     
  7. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
    Changing it to DateTime.NowUtc gives error Error 478 'System.DateTime' does not contain a definition for 'NowUtc'.
    Changing it to DateTime.UtcNow gives error Error 483 Cannot implicitly convert type 'System.DateTime' to 'long'.
     
  8. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
  9. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    Ah yeah, sorry. It was changed to Core.TickCount. Don't believe anything I say tonight, I've been drinking.
     
    • Funny Funny x 1
  10. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
    :p I really appreciate your help oh drunken master :)
    Im still at a loss of what to change it around to though. Something like

    NextActionTime = NextActionTime - Core.TickCount;


    ?
     
  11. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    What was it before?
     
  12. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
    NextActionTime = DateTime.Now;

    here is the complete method

    Code (C#):
    1. public void GrabItems( bool ignoreNoteriety )
    2. {
    3. ArrayList items = new ArrayList();
    4. bool rejected = false;
    5. bool lootAdded = false;
    6.  
    7.  
    8.  
    9.  
    10. Emote( "*Rummages through items on the ground.*" );
    11.  
    12.  
    13.  
    14.  
    15. foreach ( Item item in GetItemsInRange( 2 ) )
    16. {
    17. if ( item.Movable )
    18. items.Add( item );
    19. else if ( item is Corpse )
    20. { // Either criminally loot any corpses or loot only corpses that we have rights to
    21. if ( ignoreNoteriety || NotorietyHandlers.CorpseNotoriety( this, (Corpse)item ) != Notoriety.Innocent )
    22. {
    23. Emote( "*Rummages through items in a corpse.*" );
    24. foreach ( Item corpseItem in ((Corpse)item).Items )
    25. items.Add( corpseItem );
    26. }
    27. }
    28. }
    29. foreach ( Item item in items )
    30. {
    31. if ( !Backpack.CheckHold( this, item, false, true ) )
    32. rejected = true;
    33. else
    34. {
    35. bool isRejected;
    36. LRReason reason;
    37.  
    38.  
    39.  
    40.  
    41. NextActionTime = DateTime.UtcNow;
    42. Lift( item, item.Amount, out isRejected, out reason );
    43.  
    44.  
    45.  
    46.  
    47. if ( !isRejected )
    48. {
    49. Drop( this, Point3D.Zero );
    50. lootAdded = true;
    51. }
    52. else
    53. {
    54. rejected = true;
    55. }
    56. }
    57. }
    58. if ( lootAdded )
    59. PlaySound( 0x2E6 ); //drop gold sound
    60. if ( rejected )
    61. Say( "I could not pick up all of the items." );
    62. }
    63.  
    It was on line 41 (which I changed)
     
  13. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    Then should be NextActionTime = Core.TickCount;
     
    • Useful Useful x 1
  14. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    NextActionTime = Core.TickCount;

    Its wanting to set that exact moment in time. You may have to check where the NextActionTime is called also.
     
    • Two Thumbs Up Two Thumbs Up x 1
    • Beer Beer x 1
  15. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    Ur fast Insanity!
     
    • Agree Agree x 1
  16. cmileto
    Offline

    cmileto Member

    Joined:
    Nov 18, 2013
    Messages:
    175
    Likes Received:
    9
    Hey ty guys!
     
    • Two Thumbs Up Two Thumbs Up x 2
    • Beer Beer x 1
  17. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    Good thing I still type fast when wasted? =D
     
    • Agree Agree x 3
  18. Sparkin
    Offline

    Sparkin New Member

    Joined:
    Dec 8, 2013
    Messages:
    2
    Likes Received:
    0
    Thanks guys :) this has helped me solve issues I was having with another script :)



    Sparkin

    *edit* Spelling
     
Similar Threads: Xanthos Evo
Forum Title Date
Windows Support Help with xanthos evo system Dec 15, 2016
Custom Releases Xanthos Auction System [ fixed for newer ServUo Repos ] Oct 13, 2017
Script Support SpellCrafting version 3.0, by Xanthos and TheOutkastDev issue Mar 9, 2017
General Discussion Xanthos Question Apr 22, 2014
General Discussion Evo Sep 29, 2017
General Discussion EvoMerc & Deed Sep 18, 2017
Script Support Evolution Creatures/Merc Package Error May 3, 2017