public override VobSendFlags Read(RakNet.BitStream stream) { VobSendFlags b = base.Read(stream); if (b.HasFlag(VobSendFlags.MCItemList)) { int itemCount = 0; stream.Read(out itemCount); for (int i = 0; i < itemCount; i++) { int itemID = 0; stream.Read(out itemID); if (!sWorld.VobDict.ContainsKey(itemID)) { throw new Exception("Item was not found! :" + itemID); } Item itm = (Item)sWorld.VobDict[itemID]; addItem(itm); } } return(b); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0; float fatness = 1f; stream.Read(out playerID); stream.Read(out fatness); if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[playerID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPCProto!"); } ((NPCProto)vob).Fatness = fatness; if (vob.Address != 0) { ((NPCProto)vob).setFatness(fatness); } }
public override VobSendFlags Read(RakNet.BitStream stream) { VobSendFlags sendFlags = base.Read(stream); if (sendFlags.HasFlag(VobSendFlags.FocusName)) { stream.Read(out focusName); } if (sendFlags.HasFlag(VobSendFlags.State)) { stream.Read(out state); } if (sendFlags.HasFlag(VobSendFlags.UseWithItem)) { int instanceID = 0; stream.Read(out instanceID); ItemInstance ii = ItemInstance.ItemInstanceDict[instanceID]; this.useWithItem = ii; } if (sendFlags.HasFlag(VobSendFlags.TriggerTarget)) { stream.Read(out triggerTarget); } return(sendFlags); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID = 0; Vec3f position = new Vec3f(); bool enabled = false; stream.Read(out plID); stream.Read(out position); stream.Read(out enabled); if (plID == 0 || !sWorld.VobDict.ContainsKey(plID)) { throw new Exception("Vob not found! " + plID); } Vob vob = sWorld.VobDict[plID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPC!"); } //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Enable: "+enabled, 0, "Program.cs", 0); if (enabled) { ((NPCProto)vob).Enable(position); } else { ((NPCProto)vob).Disable(); } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0; Vec3f scale = new Vec3f(); stream.Read(out playerID); stream.Read(out scale); if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[playerID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPCProto!"); } ((NPCProto)vob).Scale = scale; if (vob.Address != 0) { ((NPCProto)vob).setScale(scale); } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { Process process = Process.ThisProcess(); //oCNpc npc = oCNpc.Player(process); //Player.Hero.Attributes[(int)NPCAttributeFlags.ATR_HITPOINTS] = 1; float length = 0; int playerID = 0; stream.Read(out playerID); stream.Read(out length); if (!sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("PlayerID: " + playerID + " was not found!"); } NPCProto proto = (NPCProto)sWorld.VobDict[playerID]; proto.Attributes[(int)NPCAttribute.ATR_HITPOINTS] = 1; if (proto.IsSpawned) { oCNpc npc = new oCNpc(process, proto.Address); npc.DropUnconscious(length, new oCNpc(process, 0)); } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID, value; byte attribType; stream.Read(out plID); stream.Read(out attribType); stream.Read(out value); if (plID == 0 || !sWorld.VobDict.ContainsKey(plID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[plID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPC!"); } NPCProto proto = (NPCProto)vob; proto.Attributes[attribType] = value; if (vob.Address == 0) { return; } Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, vob.Address); npc.setAttributes(attribType, value); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int day = 0; byte hour = 0, minute = 0; stream.Read(out day); stream.Read(out hour); stream.Read(out minute); sWorld.Day = day; sWorld.Hour = hour; sWorld.Minute = minute; if (!(Program._state is GUC.States.GameState)) { return; } Process process = Process.ThisProcess(); oCGame.Game(process).WorldTimer.SetDay(day); oCGame.Game(process).WorldTimer.SetTime(hour, minute); if (sWorld.WeatherType != 2) { oCGame.Game(process).World.SkyControlerOutdoor.SetWeatherType(sWorld.WeatherType); } oCGame.Game(process).World.SkyControlerOutdoor.setRainTime(sWorld.StartRainHour, sWorld.StartRainMinute, sWorld.EndRainHour, sWorld.EndRainMinute); }
public static void Decompress(RakNet.BitStream source, RakNet.BitStream dest) { int len = 0; source.Read(out len); byte[] arr = new byte[len]; source.Read(arr, (uint)len); MemoryStream input = new MemoryStream(); input.Write(arr, 0, len); MemoryStream output = new MemoryStream(); Decompress(input, output); arr = output.ToArray(); dest.Reset(); dest.Write(arr, (uint)arr.Length); output.Close(); output.Dispose(); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int casterID = 0, targetID = 0, spellID = 0, itemID = 0; stream.Read(out itemID); stream.Read(out casterID); stream.Read(out targetID); stream.Read(out spellID); Vob itemVob = null; Item item = null; Vob casterVob = null; Spell spell = null; NPCProto caster = null; Vob target = null; sWorld.VobDict.TryGetValue(casterID, out casterVob); sWorld.VobDict.TryGetValue(itemID, out itemVob); if (casterVob == null) { throw new Exception("Caster was not found!"); } if (!(casterVob is NPCProto)) { throw new Exception("Caster was not a npcproto " + casterVob); } caster = (NPCProto)casterVob; if (targetID != 0) { sWorld.VobDict.TryGetValue(targetID, out target); } Spell.SpellDict.TryGetValue(spellID, out spell); if (spell == null) { throw new Exception("Spell can not be null!"); } if (caster.Address == 0) { return; } Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, caster.Address); if (target != null) { npc.MagBook.Spell_Setup(npc, new zCVob(process, target.Address), 0); } //npc.MagBook.GetSelectedSpell().Target = new zCVob(process, target.Address); npc.MagBook.SpellCast(); zERROR.GetZErr(process).Report(2, 'G', "Cast Spell! 2 ", 0, "Program.cs", 0); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0; int weaponMode = 0; stream.Read(out playerID); stream.Read(out weaponMode); if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[playerID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPCProto!"); } ((NPCProto)vob).WeaponMode = weaponMode; if (vob.Address != 0) { ((NPCProto)vob).setWeaponMode(weaponMode); } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0; int slot = 0, itemID = 0; stream.Read(out playerID); stream.Read(out slot); stream.Read(out itemID); if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[playerID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPCProto!"); } Vob itemVob = null; Item item = null; if (itemID != 0) { sWorld.VobDict.TryGetValue(itemID, out itemVob); } if (itemVob != null && itemVob is Item) { item = (Item)itemVob; } //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Set Slot Item 3: " + slot + "; NewItem: " + item + ", " + itemVob + ", " + itemID + ", " + playerID, 0, "NPCProto.Client.cs", 0); ((NPCProto)vob).setSlotItem(slot, item); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0, itemID = 0; bool equip = false; stream.Read(out playerID); stream.Read(out itemID); stream.Read(out equip); NPCProto player = (NPCProto)sWorld.VobDict[playerID]; Item item = (Item)sWorld.VobDict[itemID]; if (equip) { if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_ARMOR)) { player.Armor = item; } else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_NF)) { player.Weapon = item; } else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_FF)) { player.RangeWeapon = item; } player.EquippedList.Add(item); if (player.Address != 0) { hNpc.blockSendEquip = true; new oCNpc(Process.ThisProcess(), player.Address).Equip(new oCItem(Process.ThisProcess(), item.Address)); } } else { if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_ARMOR)) { player.Armor = null; } else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_NF)) { player.Weapon = null; } else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_FF)) { player.RangeWeapon = null; } player.EquippedList.Remove(item); if (player.Address != 0) { hNpc.blockSendUnEquip = true; new oCNpc(Process.ThisProcess(), player.Address).UnequipItem(new oCItem(Process.ThisProcess(), item.Address)); } } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int itemID = 0, amount = 0; stream.Read(out itemID); stream.Read(out amount); if (itemID == 0 || !sWorld.VobDict.ContainsKey(itemID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[itemID]; if (!(vob is Item)) { throw new Exception("Vob is not an Item!"); } Item item = (Item)vob; item.Amount = amount; zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Item-Change-Amount message!", 0, "Program.cs", 0); if (item.Address != 0) { Process process = Process.ThisProcess(); oCItem gI = new oCItem(process, item.Address); if (item.Amount <= 0) { if (item.Container is NPCProto) { new oCNpc(process, ((NPCProto)item.Container).Address).RemoveFromInv(gI, gI.Amount); } else if (item.Container is MobContainer) { new oCMobContainer(process, ((MobContainer)item.Container).Address).Remove(gI, gI.Amount); } else if (item.Container is World) { oCGame.Game(process).World.RemoveVob(gI); } } gI.Amount = item.Amount; } if (item.Amount <= 0) { sWorld.removeVob(item); } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int itemID, containerID; stream.Read(out itemID); stream.Read(out containerID); if (!sWorld.VobDict.ContainsKey(itemID)) { throw new Exception("ItemID was not found!: " + itemID); } if (!sWorld.VobDict.ContainsKey(containerID)) { throw new Exception("ContainerID was not found!: " + itemID); } Vob itemVob = sWorld.VobDict[itemID]; Vob containerVob = sWorld.VobDict[containerID]; if (!(itemVob is Item)) { throw new Exception("ItemVob is not an Item! " + itemVob); } if (!(containerVob is IContainer)) { throw new Exception("Container is not an IContainer! " + containerVob); } Item item = (Item)itemVob; IContainer container = (IContainer)containerVob; if (item.Container is MobContainer) { MobContainer itC = (MobContainer)item.Container; if (itC.Address != 0) { new oCMobContainer(Process.ThisProcess(), itC.Address).Remove(new oCItem(Process.ThisProcess(), item.Address)); } } else if (item.Container is NPCProto) { NPCProto itC = (NPCProto)item.Container; if (itC.Address != 0) { new oCNpc(Process.ThisProcess(), itC.Address).RemoveFromInv(new oCItem(Process.ThisProcess(), item.Address), item.Amount); } } container.addItem(item); zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Item-Change-Container message!", 0, "Program.cs", 0); }
public static void Decompress(RakNet.BitStream source, Stream dest) { int len = 0; source.Read(out len); byte[] arr = new byte[len]; source.Read(arr, (uint)len); MemoryStream input = new MemoryStream(); input.Write(arr, 0, len); Decompress(input, dest); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID = 0; stream.Read(out plID); if (plID == 0 || !sWorld.VobDict.ContainsKey(plID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[plID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPC!"); } if (vob.Address == 0) { return; } Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, vob.Address); zVec3 pos = npc.GetPosition(); npc.ResetPos(pos); pos.Dispose(); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID = 0; stream.Read(out plID); if (plID == 0 || !sWorld.VobDict.ContainsKey(plID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[plID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPC!"); } if (vob.Address == 0) { return; } Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, vob.Address); //npc.StartDialogAni(); zString str = zString.Create(process, "T_DIALOGGESTURE_09"); npc.GetModel().StartAnimation(str); str.Dispose(); zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "npc StartDialog: " + vob.Address, 0, "Client.cs", 0); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID = 0; stream.Read(out plID); if (plID == 0 || !sWorld.VobDict.ContainsKey(plID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[plID]; if (!(vob is Player)) { throw new Exception("Vob is not an Player!"); } if (Player.Hero == vob) { return; } vob.Despawn(); sWorld.removeVob(vob); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int vobID = 0; Vec3f dir; stream.Read(out vobID); stream.Read(out dir); if (vobID == 0 || !sWorld.VobDict.ContainsKey(vobID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[vobID]; vob.setDirection(dir); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { byte type = 0; int itemID = 0, playerID = 0, amount = 0; stream.Read(out type); stream.Read(out playerID); stream.Read(out itemID); stream.Read(out amount); ContainerItemChanged cic = (ContainerItemChanged)type; if (cic == ContainerItemChanged.itemInsertedOld) { } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID = 0, itemID = 0; stream.Read(out plID); stream.Read(out itemID); if (plID == 0 || !sWorld.VobDict.ContainsKey(plID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[plID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPC!"); } if (itemID == 0 || !sWorld.VobDict.ContainsKey(itemID)) { throw new Exception("Item not found!"); } Vob item = sWorld.VobDict[itemID]; if (!(item is Item)) { throw new Exception("Vob is not an Item!"); } NPCProto proto = (NPCProto)vob; proto.DropItem((Item)item); if (vob.Address == 0 || item.Address == 0) { return; } Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, vob.Address); oCItem it = new oCItem(process, item.Address); hNpc.dontSend = true; npc.DoDropVob(it); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { String video = ""; stream.Read(out video); CGameManager.GameManager(Process.ThisProcess()).PlayVideo(video); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { bool freeze = false; stream.Read(out freeze); oCNpc.Freeze(Process.ThisProcess(), freeze); zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Player Freeze: " + freeze, 0, "Program.cs", 0); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { byte type = 0; bool enabled = false; stream.Read(out type); stream.Read(out enabled); if (type == 0) { Player.EnableStatusMenu = enabled; Gothic.mClasses.InputHooked.deactivateStatusScreen(Process.ThisProcess(), enabled); } else if (type == 1) { Player.EnableLogMenu = enabled; Gothic.mClasses.InputHooked.deactivateLogScreen(Process.ThisProcess(), enabled); } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server) { int victimID = 0, killerID = 0; stream.Read(out victimID); stream.Read(out killerID); NPCProto victim = (NPCProto)sWorld.VobDict[victimID]; NPCProto attacker = (NPCProto)sWorld.VobDict[killerID]; Scripting.Objects.Item weapon = null; if (attacker.Weapon != null) { weapon = attacker.Weapon.ScriptingProto; } victim.ScriptingNPC.HP = 0; Scripting.Objects.Character.NPCProto.isOnDamage(victim.ScriptingNPC, DamageTypes.DAM_POINT, new Vec3f(), null, attacker.ScriptingNPC, attacker.WeaponMode, null, weapon, 0); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server) { int callBackID = 0, npcID = 0, vobID = 0; bool canSee = false; stream.Read(out callBackID); stream.Read(out npcID); stream.Read(out vobID); stream.Read(out canSee); if (!sWorld.VobDict.ContainsKey(npcID) || !sWorld.VobDict.ContainsKey(vobID)) { throw new Exception("Vob or NPC weren't in the List!"); } NPCProto proto = (NPCProto)sWorld.VobDict[npcID]; Vob vob = (Vob)sWorld.VobDict[vobID]; Scripting.Objects.Character.NPCProto.iOnCanSeeCallback(callBackID, proto.ScriptingNPC, vob.ScriptingVob, canSee); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0; bool invisible = false; stream.Read(out playerID); stream.Read(out invisible); if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Vob not found!"); } Vob vob = sWorld.VobDict[playerID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPCProto!"); } ((NPCProto)vob).setHideNames(invisible); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server) { int callBackID = 0, playerID = 0; String md5File, value; stream.Read(out callBackID); stream.Read(out playerID); stream.Read(out md5File); stream.Read(out value); if (!sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Player was not in the List!"); } Player proto = (Player)sWorld.VobDict[playerID]; Scripting.Objects.Character.Player.isOnCheckMd5(callBackID, (Scripting.Objects.Character.Player)proto.ScriptingNPC, md5File, value); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID, value; byte changeType; byte talentType; stream.Read(out plID); stream.Read(out changeType); stream.Read(out talentType); stream.Read(out value); if (plID == 0 || !sWorld.VobDict.ContainsKey(plID)) throw new Exception("Vob not found!"); Vob vob = sWorld.VobDict[plID]; if (!(vob is NPCProto)) throw new Exception("Vob is not an NPC!"); NPCProto proto = (NPCProto)vob; if (changeType == (byte)ChangeSkillType.Hitchances) proto.Hitchances[talentType] = value; else if (changeType == (byte)ChangeSkillType.Skill) proto.TalentSkills[talentType] = value; else if (changeType == (byte)ChangeSkillType.Value) proto.TalentValues[talentType] = value; else throw new Exception("Does not know type: "+changeType); if (vob.Address == 0) return; Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, vob.Address); if (changeType == (byte)ChangeSkillType.Hitchances) npc.SetHitChances(talentType, value); else if (changeType == (byte)ChangeSkillType.Skill) npc.SetTalentSkill(talentType, value); else if (changeType == (byte)ChangeSkillType.Value) npc.SetTalentValue(talentType, value); }