/* Note - this function should be resilient to stuff in the HTML changing, so if we don't find what we expect, we should just return successfully and not complain about it. */ T_Status C_DDI_Deities::Parse_Entry_Details(T_Glyph_Ptr contents, T_Deity_Info * info, T_Glyph_Ptr ptr, T_Glyph_Ptr checkpoint, vector<T_Deity_Info> * extras) { T_Status status; T_Glyph_Ptr end; ptr = Extract_Text(&info->flavor, m_pool, ptr, checkpoint, "<b>Type: </b>", "<br"); ptr = Extract_Text(&info->alignment, m_pool, ptr, checkpoint, "<b>Alignment :</b>", "</b><br"); ptr = Extract_Text(&info->gender, m_pool, ptr, checkpoint, "<b>Gender:</b>", "<br"); ptr = Extract_Text(&info->sphere, m_pool, ptr, checkpoint, "<b>Sphere:</b>", "<br"); ptr = Extract_Text(&info->dominion, m_pool, ptr, checkpoint, "<b>Dominion:</b>", "<br"); ptr = Extract_Text(&info->priests, m_pool, ptr, checkpoint, "<b>Priests:</b>", "<br"); ptr = Extract_Text(&info->adjective, m_pool, ptr, checkpoint, "<b>Adjective:</b>", "<br"); /* The description text appears after the end of the paragraph node */ ptr = Find_Text(ptr, "</p>", checkpoint, true, false); if (x_Trap_Opt(ptr == NULL)) x_Status_Return_Success(); end = Find_Text(ptr, "<p>", checkpoint, false, false); if (x_Trap_Opt(end == NULL)) x_Status_Return_Success(); *end = '\0'; status = Parse_Description_Text(&info->description, ptr, m_pool); if (x_Trap_Opt(!x_Is_Success(status))) x_Status_Return(status); *end = '<'; x_Status_Return_Success(); }
/* Note - this function should be resilient to stuff in the HTML changing, so if we don't find what we expect, we should just return successfully and not complain about it. */ T_Status C_DDI_Rituals::Parse_Entry_Details(T_Glyph_Ptr contents, T_Ritual_Info * info, T_Glyph_Ptr ptr, T_Glyph_Ptr checkpoint, vector<T_Ritual_Info> * extras) { T_Status status; T_Glyph_Ptr end; T_Glyph_Ptr starts[] = { "???", }; T_Glyph_Ptr ends[] = { "<br", "</p", "</span" }; ptr = Extract_Text(&info->flavor, m_pool, ptr, checkpoint, "<span class=\"flavor\">", "</span>"); Strip_Bad_Characters(info->flavor); /* This was parsed from the index above, but we might as well grab it again here, in case there's more information */ starts[0] = "<b>Component Cost</b>:"; ptr = Extract_Text(&info->componentcost, m_pool, ptr, checkpoint, starts, x_Array_Size(starts), ends, x_Array_Size(ends)); Strip_Bad_Characters(info->componentcost); /* Although we've parsed the skill out of the index, replace it if we can - the one on the actual page has more data (e.g. "no check" info). */ starts[0] = "<b>Key Skill</b>:"; ptr = Extract_Text(&info->keyskill, m_pool, ptr, checkpoint, starts, x_Array_Size(starts), ends, x_Array_Size(ends)); Strip_Bad_Characters(info->keyskill); /* Although we've parsed the level out of the index, replace it if we can - the one on the actual page has more data. */ starts[0] = "<b>Level</b>:"; ptr = Extract_Text(&info->level, m_pool, ptr, checkpoint, starts, x_Array_Size(starts), ends, x_Array_Size(ends)); Strip_Bad_Characters(info->level); starts[0] = "<b>Category</b>:"; ptr = Extract_Text(&info->category, m_pool, ptr, checkpoint, starts, x_Array_Size(starts), ends, x_Array_Size(ends)); Strip_Bad_Characters(info->category); starts[0] = "<b>Time</b>:"; ptr = Extract_Text(&info->time, m_pool, ptr, checkpoint, starts, x_Array_Size(starts), ends, x_Array_Size(ends)); Strip_Bad_Characters(info->time); starts[0] = "<b>Duration</b>:"; ptr = Extract_Text(&info->duration, m_pool, ptr, checkpoint, starts, x_Array_Size(starts), ends, x_Array_Size(ends)); Strip_Bad_Characters(info->duration); starts[0] = "<b>Prerequisite</b>:"; ptr = Extract_Text(&info->prerequisite, m_pool, ptr, checkpoint, starts, x_Array_Size(starts), ends, x_Array_Size(ends)); Strip_Bad_Characters(info->prerequisite); /* Parse out any paragraph close tag we encounter here */ if (strnicmp(ptr, "</p>", 4) == 0) ptr += 4; /* Now parse the rest of the description - it might end in a </p> tag, or it might not! Who knows! */ end = Find_Text(ptr, "</p>", checkpoint, false, false); if (end == NULL) end = checkpoint; *end = '\0'; status = Parse_Description_Text(&info->description, ptr, m_pool); if (x_Trap_Opt(!x_Is_Success(status))) x_Status_Return(status); *end = '<'; x_Status_Return_Success(); }