public void OnMapEnterStream(CM_DRAGON_STREAM p) { if (map.MapObjects[p.StreamID] is ActorMapObj stream) { if (stream.DragonStream) { bool Debugging = false; if (stream.SpecialMapID != 0) { if (Debugging) { SM_SERVER_MESSAGE c = new SM_SERVER_MESSAGE() { MessagePosition = SM_SERVER_MESSAGE.Positions.ChatWindow, Message = string.Format("Dragon Stream:0x{0:X16}", stream.ActorID) }; Network.SendPacket(c); } else { MapTeleport(stream); } } else { OnMapTeleport(stream, Debugging); } } } }
public void OnGetTime() { System.TimeSpan length = DateTime.Now - loginTime; String output = "You've been online for: "; if (length.Days > 0) { output += String.Format("{0} Days ", length.Days); } if (length.Hours > 0) { output += String.Format("{0} Hours ", length.Hours); } if (length.Minutes > 0) { output += String.Format("{0} Minutes ", length.Minutes); } if (length.Seconds > 0) { output += String.Format("{0} Seconds ", length.Seconds); } SM_SERVER_MESSAGE r = new SM_SERVER_MESSAGE() { MessagePosition = SM_SERVER_MESSAGE.Positions.ChatWindow, Message = output }; Network.SendPacket(r); }
public void SendServerMessage(string txt, SM_SERVER_MESSAGE.Positions position) { SM_SERVER_MESSAGE p = new SM_SERVER_MESSAGE() { MessagePosition = position, Message = txt }; Network.SendPacket(p); }
public void OnSkillCast(CM_SKILL_CAST p) { //Logger.Log.Info(string.Format("SkillCast:ID{0} Target:0x{1:X} Dir:{2}", p.SkillID, p.ActorID, p.Dir)); if (chara.Skills.ContainsKey(p.SkillID)) { Skill skill = chara.Skills[p.SkillID]; Actor target = map.GetActor(p.ActorID); if (skill.ID == 12300 && ((ActorNPC)target).NpcID == 218) { SM_SERVER_MESSAGE r = new SM_SERVER_MESSAGE() { MessagePosition = SM_SERVER_MESSAGE.Positions.ChatWindow, Message = "This skill has been disabled for this boss due to abuse." }; Network.SendPacket(r); return; } SkillArg arg = new SkillArg() { Caster = chara, Target = (ActorExt)target, Skill = skill, Dir = p.Dir }; Interlocked.Increment(ref skillSession); arg.SkillSession = (byte)skillSession; if (SkillManager.Instance.SkillCast(arg)) { /*SM_SKILL_CAST_RESULT p1 = new SM_SKILL_CAST_RESULT(); * p1.SkillSession = arg.SkillSession; * p1.SkillID = skill.ID; * this.Network.SendPacket(p1);*/ ChangeCombatStatus(true); } else { Skills.SkillManager.Instance.BroadcastSkillCast(arg, SkillMode.DurationEnd); } } else { Logger.Log.Warn(string.Format("Player:{0}({1}) does not have SkillID:{2}", chara.Name, chara.CharID, p.SkillID)); SM_SKILL_CAST_RESULT p1 = new SM_SKILL_CAST_RESULT() { SkillSession = 0x60, Unknown = 1, SkillID = p.SkillID }; Network.SendPacket(p1); } }
public void OnAddCraft(CM_ADD_CRAFT p) { SM_ADD_CRAFT r = new SM_ADD_CRAFT(); SM_PLAYER_UPDATE_LIST r2 = new SM_PLAYER_UPDATE_LIST(); Network.SendPacket(r); UpdateEvent Event = new UpdateEvent(); switch ((Crafts)p.Craft) { case Crafts.Logger: case Crafts.Horticulture: case Crafts.Harvester: case Crafts.Herbalist: case Crafts.Miner: case Crafts.StoneCutter: case Crafts.Fisher: { if (Character.Craft1 == Crafts.None) { Character.Craft1 = (Crafts)p.Craft; Event.AddActorPara(PacketParameter.Craft1, p.Craft); r2.Parameters = Event; Network.SendPacket(r2); } else if (Character.Craft2 == Crafts.None) { Character.Craft2 = (Crafts)p.Craft; Event.AddActorPara(PacketParameter.Craft2, p.Craft); r2.Parameters = Event; Network.SendPacket(r2); } } break; case Crafts.Cooking: case Crafts.Potion: case Crafts.WeaponSmith: case Crafts.ForceSmith: case Crafts.BoPae: case Crafts.Jewel: case Crafts.Pottery: { if (Character.Craft3 == Crafts.None) { Character.Craft3 = (Crafts)p.Craft; Event.AddActorPara(PacketParameter.Craft3, p.Craft); r2.Parameters = Event; Network.SendPacket(r2); } else if (Character.Craft4 == Crafts.None) { Character.Craft4 = (Crafts)p.Craft; Event.AddActorPara(PacketParameter.Craft4, p.Craft); r2.Parameters = Event; Network.SendPacket(r2); } } break; default: { SM_SERVER_MESSAGE r3 = new SM_SERVER_MESSAGE() { MessagePosition = SM_SERVER_MESSAGE.Positions.ChatWindow, Message = "Unknown Craft please report to LokiReborn." }; Network.SendPacket(r3); } break; } }
public void OnItemSell(CM_ITEM_SELL p) { Dictionary <ushort, ushort> items = p.Items; List <Common.Item.Item> shouldRemove = new List <Common.Item.Item>(); foreach (ushort i in items.Keys) { Common.Item.Item review = chara.Inventory.Container[Containers.Inventory][i]; if (review != null) { if (review.Count >= items[i] && items[i] > 0 && review.Container == Containers.Inventory) { chara.Inventory.RemoveItemSlot(Containers.Inventory, i, items[i], out List <Common.Item.Item> updated, out List <Common.Item.Item> removed); if (removed.Count > 0) { SendItemUpdate(ItemUpdateMethod.Sold, removed); } if (updated.Count > 0) { SendItemUpdate(ItemUpdateMethod.Sold, updated); } uint price = 0; foreach (Common.Item.Item item in removed) { price = item.BaseData.Price; item.SlotID = 255; } CharacterSession.Instance.SaveItem(removed); foreach (Common.Item.Item item in updated) { Common.Item.Item newItem = ItemFactory.Instance.CreateNewItem(item.ItemID); newItem.CharID = chara.CharID; newItem.Count = items[i]; newItem.SlotID = 255; CharacterSession.Instance.CreateItem(newItem); removed.Add(newItem); price = newItem.BaseData.Price; } price *= items[i]; Interlocked.Add(ref chara.Gold, (int)price); SendPlayerGold(); foreach (Common.Item.Item item in removed) { item.Count = items[i]; lock (chara.Inventory.SoldItems) { while (chara.Inventory.SoldItems.Count >= 14) { shouldRemove.Add(chara.Inventory.SoldItems[0]); chara.Inventory.SoldItems.RemoveAt(0); } chara.Inventory.SoldItems.Add(item); } } } else { SM_SERVER_MESSAGE r = new SM_SERVER_MESSAGE() { MessagePosition = SM_SERVER_MESSAGE.Positions.ChatWindow, Message = "Bug fixed, better luck next time." }; Network.SendPacket(r); } } } if (shouldRemove.Count > 0) { CharacterSession.Instance.DeleteItem(shouldRemove); } SendItemBuyBackList(); }
private void OnMapTeleport(ActorMapObj stream, bool Debugging) { List <UpdateEvent> events = new List <UpdateEvent>(); UpdateEvent toadd4, toadd3, toadd2, toadd; LockForTeleport(true); toadd = new UpdateEvent() { Actor = chara, Target = stream, UpdateType = UpdateTypes.DragonStream, AdditionCount = 0, X = 0, Y = 0, Z = 0 }; events.Add(toadd); toadd2 = new UpdateEvent() { Actor = chara, Target = stream, UpdateType = UpdateTypes.DragonStream, AdditionCount = 1, X = (short)stream.X, Y = (short)stream.Y, Z = (short)stream.Z }; events.Add(toadd2); toadd3 = new UpdateEvent() { Actor = chara, Target = chara, UpdateType = UpdateTypes.Actor, AdditionID = 65002, AdditionSession = 0x7001, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Activate, SkillSession = 0xFF }; //toadd3.AddActorPara(Common.Packets.GameServer.PacketParameter.UnkD4, 1); events.Add(toadd3); toadd4 = new UpdateEvent() { UpdateType = UpdateTypes.ActorExtension, Actor = chara, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Activate, AdditionID = 65002, AdditionSession = 0x7001, RestTime = 0x1388, AdditionCount = 1 }; events.Add(toadd4); SendActorUpdates(events); toadd.ActorUpdateParameters.Clear(); toadd2.ActorUpdateParameters.Clear(); toadd3.ActorUpdateParameters.Clear(); toadd4.ActorUpdateParameters.Clear(); events.Clear(); toadd = null; toadd2 = null; chara.X = stream.X; chara.Y = stream.Y; chara.Z = stream.Z; LockForTeleport(false); toadd3.ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel; //toadd3.AddActorPara(Common.Packets.GameServer.PacketParameter.UnkD4, 0); toadd3.UserData = Conversions.HexStr2Bytes("090000"); events.Add(toadd3); toadd4.ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel; events.Add(toadd4); SendActorUpdates(events); toadd3.ActorUpdateParameters.Clear(); toadd4.ActorUpdateParameters.Clear(); events.Clear(); if (Debugging) { SM_SERVER_MESSAGE c = new SM_SERVER_MESSAGE() { MessagePosition = SM_SERVER_MESSAGE.Positions.ChatWindow, Message = string.Format("Dragon Stream:0x{0:X16}", stream.ActorID) }; Network.SendPacket(c); } }