public void OnActorItemDrop(CM_ACTOR_ITEM_DROP p) { if (chara.HoldingItem != null) { ActorItem item = chara.HoldingItem; Tasks.Actor.ItemDeleteTask deleteTask = new Tasks.Actor.ItemDeleteTask(item); deleteTask.Activate(); SendHoldItemCancel(chara.HoldingItem.ObjectID, false); MoveArgument arg = new MoveArgument() { X = p.X, Y = p.Y, Z = p.Z, BNSMoveType = SagaBNS.GameServer.Map.MoveType.Run }; map.MoveActor(item, arg); Tasks.Player.ActorItemPickDropTask task = new Tasks.Player.ActorItemPickDropTask(chara, item, Tasks.Player.ActorItemPickDropTask.ActionTypes.Drop); chara.Tasks["ActorItemPickDropTask"] = task; task.Activate(); UpdateEvent evt = new UpdateEvent() { UpdateType = UpdateTypes.ItemShow, Actor = chara, Target = item, X = p.X, Y = p.Y, Z = p.Z, UserData = 200 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, chara, true); } }
public void OnActorCorpsePickUp(CM_ACTOR_CORPSE_PICK_UP p) { if (map.GetActor(p.ActorID) is ActorCorpse corpse) { if (!corpse.PickUp && corpse.NPC.BaseData.CorpseItemID > 0) { corpse.PickUp = true; corpse.ShouldDisappear = true; SendHoldItem(corpse.NPC.BaseData.CorpseItemID, corpse.ActorID); UpdateEvent evt = new UpdateEvent() { Actor = corpse, Target = chara, UpdateType = UpdateTypes.DeleteCorpse }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, corpse, false); Tasks.Player.ActorItemPickDropTask task = new Tasks.Player.ActorItemPickDropTask(chara, corpse, Tasks.Player.ActorItemPickDropTask.ActionTypes.PickCorpse); chara.Tasks["ActorItemPickDropTask"] = task; task.Activate(); } } }
public void OnActorItemPickUp(CM_ACTOR_ITEM_PICK_UP p) { if (map.GetActor(p.ActorID) is ActorItem item) { if (chara.DistanceToActor(item) < 50) { if (item.Tasks.TryRemove("ItemDelete", out Task removed)) { removed.Deactivate(); } chara.HoldingItem = item; SendHoldItem(item); UpdateEvent evt = new UpdateEvent() { UpdateType = UpdateTypes.ItemHide, Actor = chara, Target = item }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, chara, true); Tasks.Player.ActorItemPickDropTask task = new Tasks.Player.ActorItemPickDropTask(chara, item, Tasks.Player.ActorItemPickDropTask.ActionTypes.Pick); chara.Tasks["ActorItemPickDropTask"] = task; task.Activate(); } } }