public static bool Parse( ref Tokenizer tokenizer, out ArmorSetPiece piece) { piece = new ArmorSetPiece(); piece.id = 0; tokenizer.Expect(TokenName.OPEN_PARENTHESIS); if (!tokenizer.ExpectNumber(out piece.id)) { return false; } if (!tokenizer.ExpectIntegerList(out piece.jewel_ids)) { return false; } return tokenizer.Expect(TokenName.CLOSE_PARENTHESIS); }
public static bool Parse( ref Tokenizer tokenizer, out ArmorSetPiece piece) { piece = new ArmorSetPiece(); piece.id = 0; tokenizer.Expect(TokenName.OPEN_PARENTHESIS); if (!tokenizer.ExpectNumber(out piece.id)) { return(false); } if (!tokenizer.ExpectIntegerList(out piece.jewel_ids)) { return(false); } return(tokenizer.Expect(TokenName.CLOSE_PARENTHESIS)); }
public static bool Parse(ref Tokenizer tokenizer, out ArmorSet answer) { answer = new ArmorSet(); if (!tokenizer.Expect(TokenName.OPEN_PARENTHESIS)) { return(false); } do { Instruction instruction = ReadInstruction(ref tokenizer); switch (instruction) { case Instruction.GEAR: if (!ArmorSetPiece.Parse(ref tokenizer, out answer.gear)) { return(false); } answer.weapon_slots = answer.gear.id; break; case Instruction.HEAD: if (!ArmorSetPiece.Parse(ref tokenizer, out answer.head)) { return(false); } break; case Instruction.BODY: if (!ArmorSetPiece.Parse(ref tokenizer, out answer.body)) { return(false); } break; case Instruction.ARMS: if (!ArmorSetPiece.Parse(ref tokenizer, out answer.arms)) { return(false); } break; case Instruction.WAIST: if (!ArmorSetPiece.Parse(ref tokenizer, out answer.waist)) { return(false); } break; case Instruction.LEGS: if (!ArmorSetPiece.Parse(ref tokenizer, out answer.legs)) { return(false); } break; case Instruction.AMULET: if (!Amulet.Parse(ref tokenizer, out answer.amulet)) { return(false); } break; case Instruction.COMPLETE: return(true); default: return(false); } } while (!tokenizer.Empty()); return(false); }