public override void setPosition(Vec2i pos) { this.position.set(pos); for (int i = 0; i < textarr.Length; i++) { textarr[i].PosX = this.position.X; textarr[i].PosY = this.position.Y + i * (InputHooked.PixelToVirtualY(Process.ThisProcess(), thisView.Font.GetFontY() + 5)); } }
public static Int32 hook_Render(String message) { try { Process process = Process.ThisProcess(); InputHooked.Update(process); _state.Init(); _state.update(); long time = DateTime.Now.Ticks; Now = time; timer.Timer[] arr = TimerList.ToArray(); foreach (timer.Timer timer in arr) { timer.iUpdate(time); } if (OnRender != null) { OnRender(process, time); } if (OnRenderTimedSecond != null && s_OnRenderCalledLastSecond < time) { OnRenderTimedSecond(process, time); s_OnRenderCalledLastSecond = time + 10000000; } } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(4, 'G', ex.ToString(), 0, "Program.cs", 0); } return(0); }
public override void InputUpdate(ManagedListBox mlb, WinApi.User.Enumeration.VirtualKeys key) { if (key == VirtualKeys.Up) { mlb.ActiveID--; } if (key == VirtualKeys.Down || key == VirtualKeys.Return) { mlb.ActiveID++; } //Rückgänig if ((int)key == 8) { if (((String)mData).Length == 0) { return; } mData = ((String)mData).Substring(0, ((String)mData).Length - 1); TextView = TextView; return; } //Taste eintragen if (((int)key < 0x30 || (int)key > 0x5A) && (int)key != 0x20 && (int)key != 222 && (int)key != 192 && (int)key != 186 && (int)key != 219 && (int)key != (int)VirtualKeys.OEMPeriod && (int)key != (int)VirtualKeys.OEMComma && (int)key != (int)VirtualKeys.OEMMinus) { return; } String keyVal = Convert.ToString((char)key); if ((int)key == 222) { keyVal = "A"; } if ((int)key == 192) { keyVal = "O"; } if ((int)key == 186) { keyVal = "U"; } if ((int)key == 219) { keyVal = "SS"; } if ((int)key == (int)VirtualKeys.N1 && InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = "!"; } if ((int)key == (int)VirtualKeys.N8 && InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = "("; } if ((int)key == (int)VirtualKeys.N9 && InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = ")"; } if ((int)key == (int)VirtualKeys.N7 && InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = "/"; } if ((int)key == 219 && InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = "?"; } if ((int)key == (int)VirtualKeys.OEMPeriod) { keyVal = "."; } if ((int)key == (int)VirtualKeys.OEMPeriod && InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = ":"; } if ((int)key == (int)VirtualKeys.OEMComma) { keyVal = ","; } if ((int)key == (int)VirtualKeys.OEMMinus) { keyVal = "-"; } if ((int)key == (int)VirtualKeys.OEMMinus && InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = "_"; } if (!InputHooked.IsPressed((int)VirtualKeys.Shift)) { keyVal = keyVal.ToLower(); } mData = (String)mData + keyVal; TextView = TextView; }
protected override void updateActive(VirtualKey key) { if (key == VirtualKey.Up) { mList.ActiveID--; } if (key == VirtualKey.Down || key == VirtualKey.Return) { mList.ActiveID++; } if (key == VirtualKey.Up || key == VirtualKey.Down || key == VirtualKey.Return) { RakNet.BitStream stream = Program.client.sentBitStream; stream.Reset(); stream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM); stream.Write((byte)NetworkID.GuiMessage); stream.Write((byte)GuiMessageType.GuiEvent); stream.Write(Player.Hero.ID); stream.Write(this.id); stream.Write((int)GUIEvents.ListTextBoxSend); stream.Write(mText); Program.client.client.Send(stream, PacketPriority.IMMEDIATE_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true); return; } if ((int)key == 8) { if (mText.Length == 0) { return; } mText = mText.Substring(0, mText.Length - 1); mTextView.Text.Set(hardText + mText); return; } String keyVal = Convert.ToString((char)key); keyVal = Gothic.mClasses.textBox.GetCharsFromKeys((WinApi.User.Enumeration.VirtualKeys)key, InputHooked.IsPressed((int)VirtualKey.Shift), InputHooked.IsPressed((int)VirtualKey.Control) && InputHooked.IsPressed((int)VirtualKey.Menu)); if (keyVal != "") { mText += keyVal; mTextView.Text.Add(keyVal); } }
private void createTextViews(int lines) { if (textarr != null) { foreach (zCViewText vt in textarr) { vt.Timed = 1; vt.Timer = 0; } } textarr = new zCViewText[lines]; for (int i = 0; i < lines; i++) { textarr[i] = thisView.CreateText(this.position.X, this.position.Y + i * (InputHooked.PixelToVirtualY(Process.ThisProcess(), thisView.Font.GetFontY())), emptyString); } }
public static Int32 hook_Render_SaveMode(String message) { Process process = Process.ThisProcess(); try { InputHooked.Update(process); if (InputHooked.IsPressed((int)DIK_Keys.DIK_O)) { InputHooked.receivers.Add(new Keytest()); //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', new oCMobLockable(process, oCNpc.Player(process).FocusVob.Address).keyInstance.Value + ";" + new oCMobLockable(process, oCNpc.Player(process).FocusVob.Address).PickLockStr.Value, 0, "Program.cs", 0); //new oCMobInter(process, oCNpc.Player(process).FocusVob.Address).StartInteraction(oCNpc.Player(process)); //oCGame.Game(process).DiveBar.SetPos(-0x2000, -0x2000); first = false; } if (InputHooked.IsPressed((int)VirtualKeys.F1) && !saveItemInstances) { StringBuilder sb = new StringBuilder(); zCArray <zCPar_Symbol> symbolArray = zCParser.getParser(process).Table; int len = symbolArray.Size; //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Symbols: " + len, 0, "Program.cs", 0); for (int i = 0; i < len; i++) { zCPar_Symbol symbol = symbolArray.get(i); String symbolName = symbol.Name.Value.Trim().ToUpper(); //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Symbol found: "+symbolName+" | "+symbol.Offset, 0, "Program.cs", 0); if (symbolName.StartsWith("IT")) { oCItem item = oCObjectFactory.GetFactory(process).CreateItem(symbolName); if (item.Address == 0 || item.VobType != zCVob.VobTypes.Item || item.Visual.Value.Trim().Length == 0) { continue; } String muni = null; if (item.Munition != 0) { oCItem munit = oCObjectFactory.GetFactory(process).CreateItem(item.Munition); muni = munit.ObjectName.Value.Trim().ToUpper(); } sb.Append("new ItemInstance("); //DamageType dmgType, int totalDamage, int range, sb.Append("\"" + symbolName + "\", "); sb.Append("\"" + item.Name + "\", "); sb.Append("\"" + item.ScemeName + "\", "); sb.Append("new int[]{" + item.Protection[0] + ", " + item.Protection[1] + ", " + item.Protection[2] + ", " + item.Protection[3] + ", " + item.Protection[4] + ", " + item.Protection[5] + ", " + item.Protection[6] + ", " + item.Protection[7] + "},"); sb.Append("new int[]{" + item.Damage[0] + ", " + item.Damage[1] + ", " + item.Damage[2] + ", " + item.Damage[3] + ", " + item.Damage[4] + ", " + item.Damage[5] + ", " + item.Damage[6] + ", " + item.Damage[7] + "},"); sb.Append(item.Value + ", "); sb.Append("(MainFlags)(" + item.MainFlag + "), "); sb.Append("(Flags)(" + item.Flags + "), "); sb.Append("(ArmorFlags)(" + item.Wear + "), "); sb.Append("(DamageType)(" + item.DamageType + "), "); sb.Append(item.DamageTotal + ", "); sb.Append(item.Range + ", "); sb.Append("\"" + item.Visual.Value.Trim() + "\", "); sb.Append("\"" + item.VisualChange.Value.Trim() + "\", "); sb.Append("\"" + item.Effect.Value.Trim() + "\", "); sb.Append(item.VisualSkin + ", "); sb.Append("(MaterialTypes)(" + item.Material + "), "); if (muni != null) { sb.Append("ItemInstance.getItemInstance(\"" + muni + "\") "); } else { sb.Append("null"); } sb.Append(");\r\n"); } } File.WriteAllText("cinstances.cs", sb.ToString()); saveItemInstances = true; } if (InputHooked.IsPressed((int)VirtualKeys.F2) && !saveMapVobs) { StringBuilder sb = new StringBuilder(); sb.AppendLine("MobInter mi = null;"); sb.AppendLine("String mapName = @\"" + oCGame.Game(process).World.WorldFileName.Value.Trim() + "\";"); Dictionary <zCVob.VobTypes, List <zCVob> > vobDict = oCGame.Game(process).World.getVobLists(zCVob.VobTypes.MobInter, zCVob.VobTypes.MobBed, zCVob.VobTypes.MobSwitch, zCVob.VobTypes.MobDoor, zCVob.VobTypes.MobContainer); foreach (KeyValuePair <zCVob.VobTypes, List <zCVob> > vobList in vobDict) { foreach (zCVob vob in vobList.Value) { if (!VobVisual.ContainsKey(vob.Address)) { sb.Append("//"); } if (vob.VobType == zCVob.VobTypes.MobInter || vob.VobType == zCVob.VobTypes.MobBed || vob.VobType == zCVob.VobTypes.MobSwitch) { oCMobInter mi = new oCMobInter(process, vob.Address); if (vob.VobType == zCVob.VobTypes.MobInter) { sb.Append("mi = new MobInter("); } else if (vob.VobType == zCVob.VobTypes.MobBed) { sb.Append("mi = new MobBed("); } else if (vob.VobType == zCVob.VobTypes.MobSwitch) { sb.Append("mi = new MobSwitch("); } if (VobVisual.ContainsKey(vob.Address)) { sb.Append("\"" + VobVisual[vob.Address] + "\", "); } else { sb.Append("\"\", "); } sb.Append("\"" + mi.Name.Value.Trim() + "\", "); //sb.Append("" + mi.Rewind.ToString().ToLower() + ", "); //sb.Append("" + mi.StateNum + ", "); if (mi.UseWithItem.Address != 0 && mi.UseWithItem.getCheckedValue() != null) { sb.Append("ItemInstance.getItemInstance(\"" + mi.UseWithItem.Value.Trim().ToUpper() + "\"), "); } else { sb.Append("null, "); } if (mi.TriggerTarget.Address != 0 && mi.TriggerTarget.getCheckedValue() != null) { sb.Append("\"" + mi.TriggerTarget.Value.Trim() + "\", "); } else { sb.Append("null, "); } sb.Append(((mi.BitField1 & (int)zCVob.BitFlag0.collDetectionDynamic) == (int)zCVob.BitFlag0.collDetectionDynamic).ToString().ToLower() + ", "); sb.Append(((mi.BitField1 & (int)zCVob.BitFlag0.collDetectionStatic) == (int)zCVob.BitFlag0.collDetectionStatic).ToString().ToLower() + "); \r\n"); } if (vob.VobType == zCVob.VobTypes.MobDoor) { oCMobDoor mi = new oCMobDoor(process, vob.Address); sb.Append("mi = new MobDoor("); if (VobVisual.ContainsKey(vob.Address)) { sb.Append("\"" + VobVisual[vob.Address] + "\", "); } else { sb.Append("\"\", "); } sb.Append("\"" + mi.Name.Value.Trim() + "\", "); sb.Append("" + mi.isLocked.ToString().ToLower() + ", "); if (mi.keyInstance.Address != 0 && mi.keyInstance.getCheckedValue() != null) { sb.Append("ItemInstance.getItemInstance(\"" + mi.keyInstance.Value.Trim().ToUpper() + "\"), "); } else { sb.Append("null, "); } if (mi.PickLockStr.Address != 0 && mi.PickLockStr.getCheckedValue() != null) { sb.Append("\"" + mi.PickLockStr.Value.Trim() + "\", "); } else { sb.Append("null, "); } if (mi.UseWithItem.Address != 0 && mi.UseWithItem.getCheckedValue() != null) { sb.Append("ItemInstance.getItemInstance(\"" + mi.UseWithItem.Value.Trim().ToUpper() + "\"), "); } else { sb.Append("null, "); } if (mi.TriggerTarget.Address != 0 && mi.TriggerTarget.getCheckedValue() != null) { sb.Append("\"" + mi.TriggerTarget.Value.Trim() + "\", "); } else { sb.Append("null, "); } sb.Append(((mi.BitField1 & (int)zCVob.BitFlag0.collDetectionDynamic) == (int)zCVob.BitFlag0.collDetectionDynamic).ToString().ToLower() + ", "); sb.Append(((mi.BitField1 & (int)zCVob.BitFlag0.collDetectionStatic) == (int)zCVob.BitFlag0.collDetectionStatic).ToString().ToLower() + "); \r\n"); } if (vob.VobType == zCVob.VobTypes.MobContainer) { oCMobContainer mi = new oCMobContainer(process, vob.Address); sb.Append("mi = new MobContainer("); if (VobVisual.ContainsKey(vob.Address)) { sb.Append("\"" + VobVisual[vob.Address] + "\", "); } else { sb.Append("\"\", "); } sb.Append("\"" + mi.Name.Value.Trim() + "\", "); //ItemLists: sb.Append("new ItemInstance[]{"); List <oCItem> itemList = mi.getItemList(); for (int i = 0; i < itemList.Count; i++) { oCItem item = itemList[i]; sb.Append("ItemInstance.getItemInstance(\"" + item.ObjectName.Value.Trim().ToUpper() + "\")"); if (i + 1 < itemList.Count) { sb.Append(", "); } } sb.Append("},"); sb.Append("new int[]{"); for (int i = 0; i < itemList.Count; i++) { oCItem item = itemList[i]; sb.Append("" + item.Amount); if (i + 1 < itemList.Count) { sb.Append(", "); } } sb.Append("},"); sb.Append("" + mi.isLocked.ToString().ToLower() + ", "); if (mi.keyInstance.Address != 0 && mi.keyInstance.getCheckedValue() != null) { sb.Append("ItemInstance.getItemInstance(\"" + mi.keyInstance.Value.Trim().ToUpper() + "\"), "); } else { sb.Append("null, "); } if (mi.PickLockStr.Address != 0 && mi.PickLockStr.getCheckedValue() != null) { sb.Append("\"" + mi.PickLockStr.Value.Trim() + "\", "); } else { sb.Append("null, "); } if (mi.UseWithItem.Address != 0 && mi.UseWithItem.getCheckedValue() != null) { sb.Append("ItemInstance.getItemInstance(\"" + mi.UseWithItem.Value.Trim().ToUpper() + "\"), "); } else { sb.Append("null, "); } if (mi.TriggerTarget.Address != 0 && mi.TriggerTarget.getCheckedValue() != null) { sb.Append("\"" + mi.TriggerTarget.Value.Trim() + "\", "); } else { sb.Append("null, "); } sb.Append(((mi.BitField1 & (int)zCVob.BitFlag0.collDetectionDynamic) == (int)zCVob.BitFlag0.collDetectionDynamic).ToString().ToLower() + ", "); sb.Append(((mi.BitField1 & (int)zCVob.BitFlag0.collDetectionStatic) == (int)zCVob.BitFlag0.collDetectionStatic).ToString().ToLower() + "); \r\n"); } sb.Append("mi.Spawn(mapName, new Vec3f("); sb.Append(vob.TrafoObjToWorld.getPosition()[0].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getPosition()[1].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getPosition()[2].ToString().Replace(",", ".") + "f), new Vec3f("); sb.Append(vob.TrafoObjToWorld.getDirection()[0].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getDirection()[1].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getDirection()[2].ToString().Replace(",", ".") + "f));\r\n\r\n"); } } File.WriteAllText("cVobs.cs", sb.ToString()); saveMapVobs = true; } if (InputHooked.IsPressed((int)VirtualKeys.F3) && !saveMapItems) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Item mi = null;"); sb.AppendLine("String mapName = @\"" + oCGame.Game(process).World.WorldFileName.Value.Trim() + "\";"); Dictionary <zCVob.VobTypes, List <zCVob> > vobDict = oCGame.Game(process).World.getVobLists(zCVob.VobTypes.Item); foreach (KeyValuePair <zCVob.VobTypes, List <zCVob> > vobList in vobDict) { foreach (zCVob vob in vobList.Value) { if (vob.VobType == zCVob.VobTypes.Item) { oCItem mi = new oCItem(process, vob.Address); sb.Append("mi = new Item("); sb.Append("ItemInstance.getItemInstance(\"" + mi.ObjectName.Value.Trim().ToUpper() + "\"), "); sb.Append("" + mi.Amount + ");\r\n"); } sb.Append("mi.Spawn(mapName, new Vec3f("); sb.Append(vob.TrafoObjToWorld.getPosition()[0].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getPosition()[1].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getPosition()[2].ToString().Replace(",", ".") + "f), new Vec3f("); sb.Append(vob.TrafoObjToWorld.getDirection()[0].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getDirection()[1].ToString().Replace(",", ".") + "f, " + vob.TrafoObjToWorld.getDirection()[2].ToString().Replace(",", ".") + "f));\r\n\r\n"); } } File.WriteAllText("cItems.cs", sb.ToString()); saveMapItems = true; } } catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', ex.ToString(), 0, "Program.cs", 0); } return(0); }