void UpdateInventoryCheckboxUI() { #if USE_CHECKBOXES string inventory = passwordView.GetInventoryCharacterCodes(); int inventoryIndex = 0; int inventoryChrIndex = 0; for (int column = 0; column < 6; column++) { { int chr = CharacterCode.CharToIndex(inventory[inventoryChrIndex]); inventoryCheckboxes[inventoryIndex + 0].SetChecked((chr & 0x1) != 0); inventoryCheckboxes[inventoryIndex + 1].SetChecked((chr & 0x2) != 0); inventoryCheckboxes[inventoryIndex + 2].SetChecked((chr & 0x4) != 0); inventoryCheckboxes[inventoryIndex + 3].SetChecked((chr & 0x8) != 0); inventoryCheckboxes[inventoryIndex + 4].SetChecked((chr & 0x10) != 0); inventoryChrIndex++; inventoryIndex += 5; } { int chr = CharacterCode.CharToIndex(inventory[inventoryChrIndex]); inventoryCheckboxes[inventoryIndex + 0].SetChecked((chr & 0x1) != 0); inventoryCheckboxes[inventoryIndex + 1].SetChecked((chr & 0x2) != 0); inventoryCheckboxes[inventoryIndex + 2].SetChecked((chr & 0x4) != 0); inventoryCheckboxes[inventoryIndex + 3].SetChecked((chr & 0x8) != 0); inventoryChrIndex++; inventoryIndex += 4; } } #endif }
public void Paint(PaintEventArgs e) { e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; e.Graphics.ScaleTransform(2, 2); e.Graphics.DrawImage(baseImage, 0, 0, 256, 224); for (int passwordStringIndex = 0; passwordStringIndex < 48; passwordStringIndex++) { Coord textPosition = StringIndexToTextPosition(passwordStringIndex); Coord textScreenPosition = TextPositionToScreenPosition(textPosition); Rectangle destRect = new Rectangle(textScreenPosition.X, textScreenPosition.Y, 8, 15); int index = CharacterCode.CharToIndex(passwordString[passwordStringIndex]); float awfulFudgeFactor = 0.5f; RectangleF sourceRect = new RectangleF(index * 8, -1, 8 - awfulFudgeFactor, 16); e.Graphics.DrawImage(glyphs, destRect, sourceRect, GraphicsUnit.Point); } Coord caretScreenPosition = TextPositionToScreenPosition(caretTextPosition); // Adjust for caret image caretScreenPosition.X -= 16; caretScreenPosition.Y += 11; e.Graphics.DrawImage(caret, caretScreenPosition.X, caretScreenPosition.Y, 16, 16); }
public int GetLocationCode() { string str = new string(passwordString); string line3 = str.Substring(24, 12); char locationCodeCharacter = line3[0]; return(CharacterCode.CharToIndex(locationCodeCharacter)); }
byte GetChecksumComponent(string passwordText) { byte result = 0; for (int i = 0; i < passwordText.Length; ++i) { byte v = (byte)CharacterCode.CharToIndex(passwordText[i]); result += v; } return(result); }
public void UpdateUI(char[] code) { int code1 = CharacterCode.CharToIndex(code[0]); int code2 = CharacterCode.CharToIndex(code[1]); int code3 = CharacterCode.CharToIndex(code[2]); // Do not reflect the changes back into the password. shouldUpdatePasswordString = false; if (code1 == 0 && code2 == 0 && code3 == 0) { characterEnabledCheckBox.Checked = false; levelLabel.Enabled = false; levelNumericUpDown.Enabled = false; weaponComboBox.Enabled = false; armorComboBox.Enabled = false; shouldUpdatePasswordString = true; return; } characterEnabledCheckBox.Checked = true; levelLabel.Enabled = true; levelNumericUpDown.Enabled = true; weaponComboBox.Enabled = true; armorComboBox.Enabled = true; switch (code2) { case 0: UpdateUIFromCode3(code1, code3, 0, Names.Armor.ClothCloak, Names.Armor.Invalid, 0, Names.Armor.ClothCloak, Names.Armor.PlateMail); break; case 1: UpdateUIFromCode3(code1, code3, 0, Names.Armor.ClothCloak, Names.Armor.Invalid, 20, Names.Armor.ClothCloak, Names.Armor.PlateMail); break; case 2: UpdateUIFromCode3(code1, code3, 20, Names.Armor.PlateMail, Names.Armor.Invalid, 40, Names.Armor.ClothCloak, Names.Armor.PlateMail); break; case 3: UpdateUIFromCode3(code1, code3, 20, Names.Armor.PlateMail, Names.Armor.Invalid, 60, Names.Armor.ClothCloak, Names.Armor.PlateMail); break; case 4: UpdateUIFromCode3(code1, code3, 20, Names.Armor.PlateMail, Names.Armor.Invalid, 80, Names.Armor.ClothCloak, Names.Armor.PlateMail); break; case 5: UpdateUIFromCode3(code1, code3, 20, Names.Armor.PlateMail, Names.Armor.Invalid, 0, Names.Armor.Corruption, Names.Armor.Corruption); break; case 6: case 7: UpdateUIFromCode3(code1, code3, 0, Names.Armor.ClothCloak, Names.Armor.Invalid, 0, Names.Armor.Corruption, Names.Armor.Corruption); break; case 8: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 0, Names.Armor.PaddedArmor, Names.Armor.MithrilArmor); break; case 9: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 20, Names.Armor.PaddedArmor, Names.Armor.MithrilArmor); break; case 10: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 40, Names.Armor.PaddedArmor, Names.Armor.MithrilArmor); break; case 11: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 60, Names.Armor.PaddedArmor, Names.Armor.MithrilArmor); break; case 12: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 80, Names.Armor.PaddedArmor, Names.Armor.MithrilArmor); break; case 13: case 14: case 15: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 0, Names.Armor.Corruption, Names.Armor.Corruption); break; case 16: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 0, Names.Armor.LeatherArmor, Names.Armor.Corruption); break; case 17: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 20, Names.Armor.LeatherArmor, Names.Armor.Corruption); break; case 18: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 40, Names.Armor.LeatherArmor, Names.Armor.Corruption); break; case 19: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 60, Names.Armor.LeatherArmor, Names.Armor.Corruption); break; case 20: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 80, Names.Armor.LeatherArmor, Names.Armor.Corruption); break; case 21: case 22: case 23: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 0, Names.Armor.Corruption, Names.Armor.Corruption); break; case 24: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 0, Names.Armor.ChainMail, Names.Armor.Corruption); break; case 25: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 20, Names.Armor.ChainMail, Names.Armor.Corruption); break; case 26: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 40, Names.Armor.ChainMail, Names.Armor.Corruption); break; case 27: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 60, Names.Armor.ChainMail, Names.Armor.Corruption); break; case 28: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 80, Names.Armor.ChainMail, Names.Armor.Corruption); break; case 29: case 30: case 31: UpdateUIFromCode3(code1, code3, 0, Names.Armor.Invalid, Names.Armor.Invalid, 0, Names.Armor.Corruption, Names.Armor.Corruption); break; default: break; } shouldUpdatePasswordString = true; }