Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- World.cs
- void Bufferscallback Agregar :
- #region AutoHuntGold
- if (client.Player.Auto)
- {
- AutoHunt.Looter(client);
- }
- #endregion
- misma clase void Characterscallback agregas el mismo codigo.
- ================================================================
- AutoHunt.cs o class AutoHunt
- public unsafe class AutoHunt
- {
- public enum Mode : byte
- {
- None,
- Start,
- EndAuto,
- EXPGained,
- Unknown4,
- Unknown5,
- KilledBy,
- ChangedMap
- }
- byte[] Packet;
- public AutoHunt()
- {
- Packet = new byte[100];
- fixed (byte* Pack = Packet)
- {
- *(ushort*)(Pack + (Packet.Length - 8)) = 0;
- *((ushort*)(Pack + 2)) = (ushort)PacketID.AutoHunt;
- }
- }
- public Mode Action
- {
- get { return (Mode)Packet[4]; }
- set { fixed (byte* Pack = Packet) *((byte*)(Pack + 4)) = (byte)value; }
- }
- public ushort Icon
- {
- get { return BitConverter.ToUInt16(Packet, 6); }
- set { fixed (byte* Pack = Packet) *((ushort*)(Pack + 6)) = value; }
- }
- public ulong EXPGained
- {
- get { return BitConverter.ToUInt64(Packet, 14); }
- set { fixed (byte* Pack = Packet) *((ulong*)(Pack + 14)) = value; }
- }
- public uint Unknown
- {
- get { return BitConverter.ToUInt32(Packet, 22); }
- set { fixed (byte* Pack = Packet) *((uint*)(Pack + 22)) = value; }
- }
- public string KilledName
- {
- set { Writer.WriteStringWithLength(value, 23, Packet); }
- }
- public byte[] ToArray()
- {
- fixed (void* Pack = Packet)
- return Packet;
- }
- public void Deserialize(byte[] Pack)
- {
- Packet = Pack;
- }
- public static void Looter(GameState client)
- {
- // if (client.Inventory.Count > 39)
- {
- {
- // if (client.Inventory.Count < 40)
- {
- foreach (var obj in client.Screen.Objects)
- {
- if (obj.MapObjType == MapObjectType.Item)
- {
- var floorItem = obj as FloorItem;
- if (floorItem == null) continue;
- if (floorItem.ValueType == FloorItem.FloorValueType.Money)
- {
- client.Send(Constants.PickupGold(floorItem.Value));
- client.SendScreen(floorItem, false);
- client.Player.Money += floorItem.Value;
- floorItem.Type = 2;
- client.RemoveScreenSpawn(floorItem, true);
- }
- if (floorItem.ValueType == FloorItem.FloorValueType.ConquerPoints)
- {
- client.Send(Constants.PickupConquerPoints(floorItem.Value));
- client.SendScreen(floorItem, false);
- client.Player.ConquerPoints += floorItem.Value;
- floorItem.Type = 2;
- client.RemoveScreenSpawn(floorItem, true);
- }
- }
- }
- }
- }
- return;
- }
- }
- public static void Process(byte[] packet, Client.GameState client)
- {
- AutoHunt AutoHunt = new AutoHunt();
- AutoHunt.Deserialize(packet);
- switch (AutoHunt.Action)
- {
- case AutoHunt.Mode.Start:
- {
- AutoHunt.Action = AutoHunt.Mode.Start;
- client.Player.AddFlag3((ulong)Update.Flags3.AutoHunting);
- client.Player.autohuntxp = 0;
- client.Player.Auto = true;
- break;
- }
- case AutoHunt.Mode.EndAuto:
- {
- AutoHunt.Action = AutoHunt.Mode.EndAuto;
- AutoHunt.EXPGained = client.Player.autohuntxp;
- client.Player.RemoveFlag3((ulong)Update.Flags3.AutoHunting);
- client.Player.autohuntxp = 0;
- client.Player.Auto = false;
- break;
- }
- case AutoHunt.Mode.EXPGained:
- {
- AutoHunt.Action = AutoHunt.Mode.EXPGained;
- AutoHunt.EXPGained = client.Player.autohuntxp;
- client.Player.RemoveFlag3((ulong)Update.Flags3.AutoHunting);
- client.Player.autohuntxp = 0;
- client.Player.Auto = false;
- break;
- }
- default: System.Console.WriteLine("[AutoHunt] Unknown Action: " + AutoHunt.Action + ""); break;
- }
- client.Send(AutoHunt.ToArray());
- }
- }
- ==============================================
- PacketHandler.cs
- #region AutoHunting (1070) o case 1070 como quieras, la comentas y agregas esta nueva :
- case 1070:
- {
- AutoHunt.Process(packet, client);
- break;
- }
- en la misma clase void LoginMessages te tirara error el region autohunt de esa variable lo borras y pones este
- client.Send(new AutoHunt() { Icon = 341 }.ToArray());
- Misma clase buscas void pickupitems y lo reemplazas por el Siguiente :
- private static void PickupItem(FloorItem floorItem, Client.GameState client)
- {
- FloorItem item;
- if ((!client.Screen.TryGetFloorItem(floorItem.UID, out floorItem) || client.Trade.InTrade) || ((client.Player.X != floorItem.X) || (client.Player.Y != floorItem.Y)))
- {
- return;
- }
- uint uID = (floorItem.Owner == null) ? 0 : floorItem.Owner.Player.UID;
- if ((((uID == 0) || (uID != client.Player.UID)) && (uID != 0)) && (Time32.Now < floorItem.OnFloor.AddSeconds(10)))
- {
- if ((client.Team != null) && client.Team.IsTeammate(uID))
- {
- if (client.Team.PickupItems && (floorItem.ValueType == FloorItem.FloorValueType.Item))
- {
- if ((floorItem.ItemID != 0x109a00) && (floorItem.ItemID != 0x109a01))
- {
- goto Label_0154;
- }
- }
- else if (client.Team.PickupMoney && (floorItem.ValueType != FloorItem.FloorValueType.Item))
- {
- goto Label_0154;
- }
- }
- client.Send(Constants.FloorItemNotAvailable);
- return;
- }
- Label_0154:
- item = new FloorItem(true);
- if (floorItem.ValueType != FloorItem.FloorValueType.Item)
- {
- client.Map.RemoveFloorItem(floorItem);
- }
- item.Type = 3;
- item.UID = client.Player.UID;
- item.X = client.Player.X;
- item.Y = client.Player.Y;
- switch (floorItem.ValueType)
- {
- case FloorItem.FloorValueType.Item:
- if (client.Inventory.Count > 0x27)
- {
- client.Send(Constants.FullInventory);
- return;
- }
- client.SendScreen(item, false);
- floorItem.Type = 2;
- client.RemoveScreenSpawn(floorItem, true);
- client.Map.RemoveFloorItem(floorItem);
- if (Database.ConquerItemInformation.BaseInformations.ContainsKey(floorItem.Item.ID))
- client.Send(Constants.PickupItem(Database.ConquerItemInformation.BaseInformations[floorItem.Item.ID].Name));
- foreach (Client.GameState state in Kernel.GamePool.Values)
- {
- state.Screen.Remove(floorItem);
- }
- if (floorItem.Item.MobDropped)
- {
- Database.ConquerItemInformation iteminfo = new Database.ConquerItemInformation(floorItem.Item.ID, floorItem.Item.Plus);
- #region AutoHunt
- if (client.Player.Auto)
- {
- AutoHunt AutoHunt = new AutoHunt();
- AutoHunt.Action = AutoHunt.Mode.Unknown5;
- AutoHunt.EXPGained = client.Player.autohuntxp;
- client.Send(AutoHunt.ToArray());
- AutoHunt.Action = AutoHunt.Mode.Unknown5;
- AutoHunt.EXPGained = client.Player.autohuntxp;
- client.Send(AutoHunt.ToArray());
- client.IncreaseExperience(client.Player.autohuntxp, false);
- client.Player.RemoveFlag3((ulong)Update.Flags3.AutoHunting);
- client.Player.autohuntxp = 0;
- client.Player.Auto = false;
- client.Inventory.Add(floorItem.Item, Game.Enums.ItemUse.CreateAndAdd);
- }
- #endregion
- if (iteminfo.BaseInformation.StackSize == 0)
- {
- client.Inventory.Add(floorItem.Item, Game.Enums.ItemUse.CreateAndAdd);
- }
- else
- {
- ConquerItem _ExistingItem;
- if (client.Inventory.GetStackContainer(iteminfo.BaseInformation.ID, iteminfo.BaseInformation.StackSize, 1, out _ExistingItem))
- {
- _ExistingItem.StackSize++;
- Database.ConquerItemTable.UpdateStack(_ExistingItem);
- _ExistingItem.Mode = Game.Enums.ItemMode.Update;
- _ExistingItem.Send(client);
- }
- else
- {
- floorItem.Item.StackSize = 1;
- client.Inventory.Add(floorItem.Item, Game.Enums.ItemUse.CreateAndAdd);
- }
- }
- //Data data = new Data(true);
- //data.ID = Data.OpenCustom;
- //data.UID = client.Player.UID;
- //data.TimeStamp = Time32.Now;
- //data.dwParam = 3382;
- //data.wParam1 = client.Player.X;
- //data.wParam2 = client.Player.Y;
- //client.Send(data);
- }
- else
- {
- client.Inventory.Add(floorItem.Item, Game.Enums.ItemUse.Add);
- //Data data = new Data(true);
- //data.ID = Data.OpenCustom;
- //data.UID = client.Player.UID;
- //data.TimeStamp = Time32.Now;
- //data.dwParam = 3382;
- //data.wParam1 = client.Player.X;
- //data.wParam2 = client.Player.Y;
- //client.Send(data);
- }
- return;
- case FloorItem.FloorValueType.Money:
- client.Send(Constants.PickupGold(floorItem.Value));
- client.SendScreen(item, false);
- client.Player.Money += floorItem.Value;
- floorItem.Type = 2;
- client.RemoveScreenSpawn(floorItem, true);
- return;
- case FloorItem.FloorValueType.ConquerPoints:
- client.Send(Constants.PickupConquerPoints(floorItem.Value));
- client.SendScreen(item, false);
- client.Player.ConquerPoints += floorItem.Value;// Math.Min(floorItem.Value, 300);
- floorItem.Type = 2;
- client.RemoveScreenSpawn(floorItem, true);
- return;
- }
- }
- ===================================================================
- Tecnicamente ya deberia funcionar Bien tanto el agarrar items como Oro. tambien hace falta añadirlo en otros lados como ser en el caso de teletransporte, en caso de que salga eventos o en caso de que te maten que Auto Reviva y siga el camino.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement