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) { 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 = 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 static Int32 GUC_PROCESSMANA_RELEASE(String message) { Process process = Process.ThisProcess(); try { #region oV int npc_ptr = zCParser.getParser(process).GetInstance(); int manaInvested = zCParser.getParser(process).getIntParameter(); oCNpc npc = new oCNpc(process, npc_ptr); int spellID = npc.GetActiveSpellNr(); Spell spell = null; Spell.SpellDict.TryGetValue(spellID, out spell); if (spell == null || spell.processMana.Length <= 1)//Stop the spell! { zCParser.getParser(process).SetReturn(3); } else { zCParser.getParser(process).SetReturn(2); } #endregion } catch (Exception ex) { zERROR.GetZErr(process).Report(2, 'G', ex.ToString(), 0, "Externals.cs", 0); } return(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 setWeaponMode(int wpMode) { int oldWeaponMode = this.weaponMode; this.weaponMode = wpMode; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); npc.SetWeaponMode(this.weaponMode); npc.SetWeaponMode2(this.weaponMode); if (this.weaponMode == 7 && oldWeaponMode != 7) { int spellID = npc.MagBook.GetKeyByItem(new oCItem(process, ActiveSpell.Address)); npc.MagBook.SpellNr = spellID - 1; npc.MagBook.Open(0); } else if (oldWeaponMode == 7 && this.weaponMode != 7) { npc.MagBook.Close(1); } } }
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); }
/// <summary> /// Not in use anymore! /// </summary> /// <param name="message"></param> /// <returns></returns> public static Int32 EV_CreateInteractItem(String message) { Process Process = Process.ThisProcess(); try { int address = Convert.ToInt32(message); oCNpc npc = new oCNpc(Process, Process.ReadInt(address)); oCMsgManipulate oDD = new oCMsgManipulate(Process, Process.ReadInt(address + 4)); oCMobInter mobinter = npc.GetInteractMob(); MobInter mobInt = null; if (sWorld.SpawnedVobDict.ContainsKey(mobinter.Address)) { mobInt = (MobInter)sWorld.SpawnedVobDict[mobinter.Address]; oDD.InstanceName.Set("ITGUC_" + mobInt.UseWithItem.ID); zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "MobInter-Setted! " + mobInt.UseWithItem.ID, 0, "Program.cs", 0); } else { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Not founded: MobInter! " + mobinter.Address, 0, "Program.cs", 0); } } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Exception: " + ex.Message + " " + ex.StackTrace + " " + ex.Source, 0, "Program.cs", 0); } return(0); }
public void setActiveSpell(Item spell) { if (ActiveSpell == spell) { return; } Item oldSpell = ActiveSpell; ActiveSpell = spell; if (this.Address == 0) { return; } Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); if (this.weaponMode == 7) { npc.MagBook.Close(1); int spellID = npc.MagBook.GetKeyByItem(new oCItem(process, ActiveSpell.Address)); npc.MagBook.SpellNr = spellID - 1; npc.MagBook.Open(0); } }
public static Int32 OnDamage_DD(String message) { if (blockSending) { blockSending = false; return(0); } Process Process = Process.ThisProcess(); try { int address = Convert.ToInt32(message); oCNpc npc = new oCNpc(Process, Process.ReadInt(address)); oSDamageDescriptor oDD = new oSDamageDescriptor(Process, Process.ReadInt(address + 4)); if (oDD.DamageType == oSDamageDescriptor.DamageTypes.DAM_FALL && oCNpc.Player(Process).Address != npc.Address) { return(0); } OnDamageMessage.Write(oDD, npc); //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "OnDamage: TotalDamage:" + oDD.DamageTotal + " | Damage-Mode: " + oDD.ModeDamage + " | Mode-Weapon: " + oDD.ModeWeapon + " | " + oDD.Damage + " | " + oDD.DamageEffective + " | " + oDD.DamageReal + " | "+npc.HumanAI.FallDownDistanceY+ " | "+oDD.SpellID+" | "+oDD.DamageType, 0, "Program.cs", 0); } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Exception: " + ex.Message + " " + ex.StackTrace + " " + ex.Source, 0, "Program.cs", 0); } return(0); }
public static Int32 StartInteraction(String message) { int address = Convert.ToInt32(message); Process process = Process.ThisProcess(); try { oCNpc npc = new oCNpc(process, process.ReadInt(address + 4)); if (oCNpc.Player(process).Address == npc.Address) { oCMobInter mobInter = new oCMobInter(process, process.ReadInt(address)); if (!sWorld.SpawnedVobDict.ContainsKey(mobInter.Address)) { return(0); } MobInter mI = (MobInter)sWorld.SpawnedVobDict[mobInter.Address]; BitStream stream = Program.client.sentBitStream; stream.Reset(); stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM); stream.Write((byte)NetworkID.MobInterMessage); stream.Write((byte)MobInterNetwork.StartInteraction); stream.Write(Player.Hero.ID); stream.Write(mI.ID); Program.client.client.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true); } } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', ex.ToString(), 0, "hMobInter.cs", 0); } return(0); }
public void SetVisual(String aVisual, String aBodyMesh, String aHeadMesh, int aBodyTex, int aSkinColor, int aHeadTex, int aTeethTex) { String _visual = aVisual.ToUpper().Trim(); bool sameVisual = _visual == this.Visual; this.Visual = _visual; this.BodyMesh = aBodyMesh; this.BodyTex = aBodyTex; this.SkinColor = aSkinColor; this.HeadMesh = aHeadMesh; this.HeadTex = aHeadTex; this.TeethTex = aTeethTex; if (this.Address == 0) { return; } Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); if (sameVisual) { npc.SetAdditionalVisuals(BodyMesh, bodyTex, skinColor, HeadMesh, headTex, teethTex, -1); } else { npc.ClearOverlays(); this.Overlays.Clear(); npc.CloseSpellBook(true); npc.SetWeaponMode2(0); npc.AniCtrl.SearchStandAni(); npc.Shrink(); npc.MDSName.Set(_visual); npc.SetAdditionalVisuals(BodyMesh, bodyTex, skinColor, HeadMesh, headTex, teethTex, -1); if (this == Player.Hero) { npc.UnShrink(); } else { npc.AvoidShrink(1000); } this.setWeaponMode(this.WeaponMode); //00AB1F28 } }
protected void tick() { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.mNPCAddress); oCGame.Game(process).GetSpawnManager().DeleteNPC(npc); End(); }
partial void pAfterEquip(NPCSlots slot, ItemInst item) { if (!this.IsSpawned) { return; } oCNpc gNpc = this.BaseInst.gVob; oCItem gItem = item.BaseInst.gVob; Gothic.Types.zString node; bool undraw = true; bool ininv = true; switch (slot) { case NPCSlots.OneHanded1: node = oCNpc.NPCNodes.Sword; break; case NPCSlots.TwoHanded: node = oCNpc.NPCNodes.Longsword; break; case NPCSlots.Ranged: node = item.ItemType == ItemTypes.WepBow ? oCNpc.NPCNodes.Bow : oCNpc.NPCNodes.Crossbow; break; case NPCSlots.Armor: node = oCNpc.NPCNodes.Torso; gItem.VisualChange.Set(item.Definition.VisualChange); break; case NPCSlots.RightHand: node = oCNpc.NPCNodes.RightHand; undraw = false; break; case NPCSlots.LeftHand: node = oCNpc.NPCNodes.LeftHand; undraw = false; break; default: return; } if (item.ModelDef.Visual.EndsWith(".ZEN")) { ininv = false; } gItem.Material = (int)item.Material; gNpc.PutInSlot(node, gItem, ininv); PlayDrawItemSound(item, undraw); }
public void setInvisible(bool invisible) { this.IsInvisible = invisible; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); npc.setShowVisual(!invisible); } }
public void setFatness(float fatness) { this.Fatness = fatness; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); npc.SetFatness(this.Fatness); } }
public static Int32 oCNpc_UnEquipItem(String message) { if (blockSendUnEquip) { blockSendUnEquip = false; return(0); } try { Process process = Process.ThisProcess(); int address = Convert.ToInt32(message); oCNpc npc = new oCNpc(process, process.ReadInt(address)); oCItem item = new oCItem(process, process.ReadInt(address + 4)); if (npc.Address != Player.Hero.Address) { return(0); } if (item.Address == 0 || !sWorld.SpawnedVobDict.ContainsKey(item.Address)) { return(0); } if (npc.Address == 0 || !sWorld.SpawnedVobDict.ContainsKey(npc.Address)) { return(0); } NPCProto npcP = (NPCProto)sWorld.SpawnedVobDict[npc.Address]; Item itemP = (Item)sWorld.SpawnedVobDict[item.Address]; npcP.EquippedList.Remove(itemP); BitStream stream = Program.client.sentBitStream; stream.Reset(); stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM); stream.Write((byte)NetworkID.EquipItemMessage); stream.Write(npcP.ID); stream.Write(itemP.ID); stream.Write(false); Program.client.client.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true); zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "UnEquip Item : " + item.Name.Value, 0, "ItemSynchro.cs", 0); } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Use Item failure:" + ex.ToString(), 0, "ItemSynchro.cs", 0); } return(0); }
public override zCVob CreateVob(zCVob vob = null) { oCNpc ret = (vob == null || !(vob is oCNpc)) ? oCNpc.Create() : (oCNpc)vob; base.CreateVob(ret); ret.Instance = this.ID; ret.Name.Set(Name); ret.SetAdditionalVisuals(BodyMesh, BodyTex, 0, HeadMesh, HeadTex, 0, -1); ret.Guild = this.Guild; ret.TrueGuild = this.guild; return(ret); }
public static Int32 oCItemContainer_Remove(String message) { try { int address = Convert.ToInt32(message); Process process = Process.ThisProcess(); oCNpc player = oCNpc.Player(process); oCNpc stealNPC = oCNpc.StealNPC(process); oCItemContainer oIC = new oCItemContainer(process, process.ReadInt(address)); int itemIndex = process.ReadInt(address + 4); int amount = process.ReadInt(address + 8); String itemName = zCParser.getParser(Process.ThisProcess()).GetSymbol(itemIndex).Name.Value; oCMobContainer mC = new oCMobContainer(process, player.GetInteractMob().Address); if (player.Inventory.Address != oIC.Address)//Use this only with the hero! { return(0); } Item it = Player.Hero.HasItem(ItemInstance.getIndex(itemName)); if (it == null)//Item was not found! { return(0); } Player.Hero.removeItem(it, amount); player.RemoveFromInv(new oCItem(Process.ThisProcess(), it.Address), amount); BitStream stream = Program.client.sentBitStream; stream.Reset(); stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM); stream.Write((byte)NetworkID.ItemRemovedByUsing); stream.Write(it.ID); stream.Write(amount); Program.client.client.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true); zERROR.GetZErr(process).Report(2, 'G', "XXXX-Removed Item, Item: " + itemName + " Amount: " + amount, 0, "Itemsynchro.cs", 0); } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', ex.Source + ": " + ex.Message + " " + ex.StackTrace, 0, "hItemContainer.cs", 0); } return(0); }
public void Disable() { enabled = false; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); hNpc.blockSendUnEquip = true; if (this.Armor != null) { npc.UnequipItem(new oCItem(process, this.Armor.Address)); } npc.Disable(); } }
public static Int32 StealContainer_setOwner(String message) { int address = Convert.ToInt32(message); Process process = Process.ThisProcess(); try { oCNpc player = new oCNpc(process, process.ReadInt(address + 4)); unblockItemInsert(player.Inventory.ItemList.size()); } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', ex.ToString(), 0, "hItemContainer.cs", 0); } //unblockItemInsert(1); return(0); }
public void setScale(Vec3f scale) { this.Scale = scale; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); zVec3 v = zVec3.Create(process); v.X = scale.X; v.Y = scale.Y; v.Z = scale.Z; npc.SetModelScale(v); v.Dispose(); } }
partial void addItemToContainer(Item item) { if (this.Address == 0) { return; } Process process = Process.ThisProcess(); oCItem it = oCObjectFactory.GetFactory(process).CreateItem("ITGUC_" + item.ItemInstance.ID); it.Amount = item.Amount; oCNpc npc = new oCNpc(Process.ThisProcess(), Address); npc.PutInInv(it); item.Address = it.Address; sWorld.SpawnedVobDict.Add(item.Address, item); }
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 setHideNames(bool hidenames) { this.hideName = hidenames; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); if (this.hideName) { npc.Name.Set(""); } else { npc.Name.Set(this.Name); } } }
public MainMenuCharacter(string help, int x, int y, int w, int h) { HelpText = help; thisVob = oCNpc.Create(); vis = new GUCVobVisual(x, y, w, h) { Lighting = true, }; UpdateOrientation(); leftArrow = new GUCVisual(x + 150, y + h / 2 - 40, 15, 20); leftArrow.SetBackTexture("L.TGA"); rightArrow = new GUCVisual(x + w - 170, y + h / 2 - 40, 15, 20); rightArrow.SetBackTexture("R.TGA"); vis.CreateText("Zoom +/-", 120, 10); }
partial void pBeforeUnequip(ItemInst item) { if (!this.IsSpawned) { return; } oCNpc gNpc = this.BaseInst.gVob; oCItem gItem = item.BaseInst.gVob; Gothic.Types.zString node; switch ((NPCSlots)item.BaseInst.Slot) { case NPCSlots.OneHanded1: node = oCNpc.NPCNodes.Sword; break; case NPCSlots.TwoHanded: node = oCNpc.NPCNodes.Longsword; break; case NPCSlots.Ranged: node = item.ItemType == ItemTypes.WepBow ? oCNpc.NPCNodes.Bow : oCNpc.NPCNodes.Crossbow; break; case NPCSlots.Armor: node = oCNpc.NPCNodes.Torso; break; case NPCSlots.RightHand: node = oCNpc.NPCNodes.RightHand; break; case NPCSlots.LeftHand: node = oCNpc.NPCNodes.LeftHand; break; default: return; } gNpc.RemoveFromSlot(node, false, true); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0; stream.Read(out playerID); if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Vob not found! " + playerID); } Vob vob = sWorld.VobDict[playerID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPCProto! " + playerID); } NPCProto npc = (NPCProto)vob; if (npc.Address != 0) { foreach (Item item in npc.ItemList) { Process process = Process.ThisProcess(); oCItem gI = new oCItem(process, item.Address); oCNpc n = new oCNpc(process, npc.Address); hNpc.blockSendUnEquip = true; n.UnequipItem(gI); n.RemoveFromInv(gI, gI.Amount); gI.Amount = 0; } } foreach (Item item in npc.ItemList) { sWorld.removeVob(item); } npc.ItemList.Clear(); }
protected void SendPlayerPosition(Process process, NPCProto proto) { if (proto.Address != 0) { oCNpc npc = new oCNpc(process, proto.Address); proto.Position = (Vec3f)npc.TrafoObjToWorld.getPosition(); proto.Direction = (Vec3f)npc.TrafoObjToWorld.getDirection(); } BitStream stream = Program.client.sentBitStream; stream.Reset(); stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM); stream.Write((byte)NetworkID.SetVobPosDirMessage); stream.Write(proto.ID); stream.Write(proto.Position); stream.Write(proto.Direction); Program.client.client.Send(stream, PacketPriority.LOW_PRIORITY, PacketReliability.UNRELIABLE_SEQUENCED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int plID; String levelName; Vec3f pos, dir; stream.Read(out plID); stream.Read(out levelName); stream.Read(out pos); stream.Read(out dir); 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 playerVob = (NPCProto)vob; Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, vob.Address); if (vob is Player && vob == Player.Hero) { ((Player)vob).spawned(); playerVob.Map = levelName; zString level = zString.Create(process, playerVob.Map); oCGame.Game(process).ChangeLevel(level, level); level.Dispose(); vob.setDirection(dir); vob.setPosition(pos); Program._state = new GameState(); } }