public QCandidate ReadSubCandidate(QueryingReadContext context, ITypeHandler4 handler ) { ObjectID objectID = ObjectID.NotPossible; try { int offset = context.Offset(); if (handler is IReadsObjectIds) { objectID = ((IReadsObjectIds)handler).ReadObjectID(context); } if (objectID.IsValid()) { return(new QCandidate(this, null, objectID._id)); } if (objectID == ObjectID.NotPossible) { context.Seek(offset); object obj = context.Read(handler); if (obj != null) { QCandidate candidate = new QCandidate(this, obj, context.Container().GetID(context .Transaction(), obj)); candidate.ClassMetadata(context.Container().ClassMetadataForObject(obj)); return(candidate); } } } catch (Exception) { } // FIXME: Catchall return(null); }
public virtual void ReadID(IReadsObjectIds objectIDHandler) { ObjectID objectID = objectIDHandler.ReadObjectID(this); if (objectID.IsValid()) { AddId(objectID._id); } }
/// <summary> /// Overrides Update from BaseClient to trigger advertising in intervals. /// </summary> public override void Update() { base.Update(); // make sure to not execute it too early before fully logged in if (ObjectID.IsValid(Data.AvatarID) && Data.InventoryObjects.Count > 0) { string message; // time to broadcast if (GameTick.CanBroadcast()) { // get adv. message message = GetAdvertisement(); // content? if (message != null) { // try to broadcast buffbot advert SendSayToMessage(ChatTransmissionType.Everyone, message); // log Log("BOT", "Advertisement broadcasted"); // additionally mark said also GameTick.DidSay(); } } if (!isMeditateInProcess) { if (Data.VigorPoints < 60) { InventoryObject inventoryObject = Data.InventoryObjects.GetItemByName("inky-cap mushroom", false); Thread InkyThread = new Thread(delegate() { UseInky(inventoryObject); }); InkyThread.Start(); } } if (!isMeditateInProcess && !isBuffingInProcess) { if (Data.ManaPoints < 50) { Thread MeditateThread = new Thread(new ThreadStart(CastMeditate)); MeditateThread.Start(); } } } }
/// <summary> /// Overrides Update from BaseClient to trigger advertising in intervals. /// </summary> public override void Update() { base.Update(); // make sure to not execute it too early before fully logged in if (ObjectID.IsValid(Data.AvatarID) && Data.InventoryObjects.Count > 0) { string message; // time to broadcast if (GameTick.CanBroadcast()) { // get adv. message message = GetAdvertisement(); // content? if (message != null) { // try to broadcast shop offers SendSayToMessage(ChatTransmissionType.Everyone, message); // log Log("BOT", LOG_ADVBROADCASTED); // additionally mark said also GameTick.DidSay(); } } // time to say if (GameTick.CanSay()) { // get adv. message message = GetAdvertisement(); // content? if (message != null) { // try to broadcast shop offers SendSayToMessage(ChatTransmissionType.Normal, message); // log Log("BOT", LOG_ADVSAID); } } } }
public virtual void ReadId(ITypeHandler4 handler) { ObjectID objectID = ObjectID.NotPossible; try { int offset = Offset(); if (handler is IReadsObjectIds) { objectID = ((IReadsObjectIds)handler).ReadObjectID(this); } if (objectID.IsValid()) { AddId(objectID._id); return; } if (objectID == ObjectID.NotPossible) { Seek(offset); // FIXME: there's no point in activating the object // just find its id // type handlers know how to do it object obj = Read(handler); if (obj != null) { int id = (int)GetID(obj); if (id > 0) { AddId(id); } else { AddObjectWithoutId(obj); } } } } catch (Exception) { } }
/// <summary> /// Overrides Update from BaseClient to tasks in intervals. /// </summary> public override void Update() { base.Update(); // ... if (!Data.IsWaiting && ObjectID.IsValid(Data.AvatarID) && Data.SpellObjects.Count > 0 && Data.AvatarSpells.Count > 0 && GameTick.Current > tickSleepUntil) { // get next task currentTask = Config.GetNextTask(); // no task? if (currentTask == null) { // log Log("ERROR", "No task found."); return; } // rest if (currentTask is BotTaskRest) { DoRest((BotTaskRest)currentTask); } // stand else if (currentTask is BotTaskStand) { DoStand((BotTaskStand)currentTask); } // sleep: blocks executions until sleep is over else if (currentTask is BotTaskSleep) { DoSleep((BotTaskSleep)currentTask); } // cast else if (currentTask is BotTaskCast) { DoCast((BotTaskCast)currentTask); } // use else if (currentTask is BotTaskUse) { DoUse((BotTaskUse)currentTask); } // say else if (currentTask is BotTaskSay) { DoSay((BotTaskSay)currentTask); } } double slp = (tickSleepUntil - GameTick.Current) / (double)Common.GameTick.MSINSECOND; // draw sleep & imps DrawDynamic("SLP: " + string.Format("{0:N0}", slp).PadRight(3) + " IMPS: " + imps.ToString().PadRight(3)); }