//TITLE SCREEN public void redrawLauncher() { //DRAW TITLE SCREEN if ((titleList.Count > 0) && (moduleIndex < titleList.Count)) { IbRect src = new IbRect(0, 0, titleList[moduleIndex].PixelSize.Width, titleList[moduleIndex].PixelSize.Height); IbRect dst = new IbRect((gv.screenWidth / 2) - (gv.squareSize * 4), 0, gv.squareSize * 8, gv.squareSize * 4); gv.DrawBitmap(titleList[moduleIndex], src, dst); } //DRAW DESCRIPTION BOX if ((moduleList.Count > 0) && (moduleIndex < moduleList.Count)) { string textToSpan = "<u>Module Description</u>" + "<br>"; //textToSpan += "<b><i><big>" + moduleList[moduleIndex].moduleLabelName + "</big></i></b><br>"; textToSpan += moduleList[moduleIndex].moduleDescription; description.logLinesList.Clear(); description.AddHtmlTextToLog(textToSpan); description.tbXloc = 4 * gv.squareSize + gv.oXshift; description.tbYloc = 6 * gv.squareSize + gv.oYshift; description.tbWidth = 12 * gv.squareSize; description.tbHeight = 6 * gv.squareSize; description.onDrawLogBox(); btnModuleName.Text = moduleList[moduleIndex].moduleLabelName; drawLauncherControls(); } }
//CAST SELECTOR SCREEN (COMBAT and MAIN) public void redrawCastSelector(bool inCombat) { Player pc = getCastingPlayer(); isInCombat = inCombat; //IF CONTROLS ARE NULL, CREATE THEM if (btnSelect == null) { setControlsStart(); } btnSelect.Text = pc.playerClass.labelForCastAction.ToUpper() + " SELECTED " + gv.mod.getPlayerClass(getCastingPlayer().classTag).spellLabelSingular.ToUpper(); int pW = (int)((float)gv.screenWidth / 100.0f); int pH = (int)((float)gv.screenHeight / 100.0f); int locY = 0; int locX = pW * 4; //int textH = (int)gv.cc.MeasureString("GetHeight", gv.drawFontReg, gv.Width).Height; int textH = (int)gv.drawFontRegHeight; int spacing = textH; //int spacing = (int)gv.mSheetTextPaint.getTextSize() + pH; int tabX = pW * 4; int noticeX = pW * 5; int noticeY = pH * 3 + spacing; int leftStartY = pH * 3; int tabStartY = 4 * gv.squareSize + pW * 10; //DRAW TEXT locY = (gv.squareSize * 0) + (pH * 2); //gv.mSheetTextPaint.setColor(Color.LTGRAY); gv.DrawText("Select a " + gv.mod.getPlayerClass(pc.classTag).spellLabelSingular + " to " + gv.mod.getPlayerClass(pc.classTag).labelForCastAction, noticeX, pH * 3); //gv.DrawText("Select a " + gv.mod.getPlayerClass(pc.classTag).spellLabelSingular + " to Cast", noticeX, pH * 3, "wh"); //gv.mSheetTextPaint.setColor(Color.YELLOW); gv.DrawText(getCastingPlayer().name + " SP: " + getCastingPlayer().sp + "/" + getCastingPlayer().spMax, pW * 55, leftStartY); gv.DrawText(getCastingPlayer().name + " HP: " + getCastingPlayer().hp + "/" + getCastingPlayer().hpMax, pW * 55, leftStartY + (int)(gv.squareSize / 3)); //DRAW NOTIFICATIONS //here insert sortTraitsForLevelUp(pc); if (isSelectedSpellSlotInKnownSpellsRange()) { Spell sp = GetCurrentlySelectedSpell(); //Player pc = getCastingPlayer(); bool swiftBlocked = false; if (sp.isSwiftAction && gv.mod.swiftActionHasBeenUsedThisTurn) { swiftBlocked = true; } bool coolBlocked = false; int coolDownTime = 0; for (int i = 0; i < pc.coolingSpellsByTag.Count; i++) { if (pc.coolingSpellsByTag[i] == sp.tag) { coolBlocked = true; coolDownTime = pc.coolDownTimes[i]; if (coolDownTime < sp.coolDownTime) { coolDownTime++; } } } if (coolBlocked) { gv.DrawText("This is still cooling down for " + coolDownTime + " turn(s).", noticeX, noticeY, 1.0f, Color.Red); } else if (swiftBlocked) { gv.DrawText("Swift action already used this turn.", noticeX, noticeY, 1.0f, Color.Red); } else if ((pc.sp >= sp.costSP) && ((pc.hp - 1) >= sp.costHP) && !gv.mod.nonRepeatableFreeActionsUsedThisTurnBySpellTag.Contains(sp.tag)) { //gv.mSheetTextPaint.setColor(Color.GREEN); gv.DrawText("Available", noticeX, noticeY, 1.0f, Color.Lime); } else if (!gv.mod.nonRepeatableFreeActionsUsedThisTurnBySpellTag.Contains(sp.tag)) //if known but not enough spell points, "Insufficient SP to Cast" in yellow { //gv.mSheetTextPaint.setColor(Color.YELLOW); gv.DrawText("Insufficient SP or HP", noticeX, noticeY, 1.0f, Color.Red); } else { gv.DrawText("This can only be used once per turn.", noticeX, noticeY, 1.0f, Color.Red); } } //DRAW ALL SPELL SLOTS int cntSlot = 0; foreach (IbbButton btn in btnSpellSlots) { //Player pc = getCastingPlayer(); if (cntSlot == spellSlotIndex) { btn.glowOn = true; } else { btn.glowOn = false; } if (isInCombat) { if ((cntSlot + (tknPageIndex * slotsPerPage)) < backupKnownSpellTagsInCombat.Count) { Spell sp = gv.mod.getSpellByTag(backupKnownSpellTagsInCombat[cntSlot + (tknPageIndex * slotsPerPage)]); //TraitAllowed ta = backupTraitsAllowed[cntSlot + (tknPageIndex * slotsPerPage)]; gv.cc.DisposeOfBitmap(ref btn.Img2); btn.Img2 = gv.cc.LoadBitmap(sp.spellImage); gv.cc.DisposeOfBitmap(ref btn.Img2Off); btn.Img2Off = gv.cc.LoadBitmap(sp.spellImage + "_off"); btn.btnState = buttonState.Normal; } else { gv.cc.DisposeOfBitmap(ref btn.Img); btn.Img = gv.cc.LoadBitmap("btn_small_off"); btn.Img2 = null; btn.Img2Off = null; btn.Img3 = null; btn.btnState = buttonState.Off; } } //outside combat else { if ((cntSlot + (tknPageIndex * slotsPerPage)) < backupKnownSpellTagsOutsideCombat.Count) { Spell sp = gv.mod.getSpellByTag(backupKnownSpellTagsOutsideCombat[cntSlot + (tknPageIndex * slotsPerPage)]); //TraitAllowed ta = backupTraitsAllowed[cntSlot + (tknPageIndex * slotsPerPage)]; gv.cc.DisposeOfBitmap(ref btn.Img2); btn.Img2 = gv.cc.LoadBitmap(sp.spellImage); gv.cc.DisposeOfBitmap(ref btn.Img2Off); btn.Img2Off = gv.cc.LoadBitmap(sp.spellImage + "_off"); btn.btnState = buttonState.Normal; } else { gv.cc.DisposeOfBitmap(ref btn.Img); btn.Img = gv.cc.LoadBitmap("btn_small_off"); btn.Img2 = null; btn.Img2Off = null; btn.Img3 = null; btn.btnState = buttonState.Off; } } btn.Draw(); cntSlot++; } //DRAW DESCRIPTION BOX locY = tabStartY; if (isSelectedSpellSlotInKnownSpellsRange()) { Spell sp = GetCurrentlySelectedSpell(); //string textToSpan = "<u>Description</u>" + "<BR>" + "<BR>"; string textToSpan = "<b><i><big>" + sp.name + "</big></i></b><BR>"; if (sp.isSwiftAction && !sp.usesTurnToActivate) { textToSpan += "Swift action" + "<BR>"; } else if (sp.onlyOncePerTurn && !sp.usesTurnToActivate) { textToSpan += "Free action, not repeatable" + "<BR>"; } else if (!sp.onlyOncePerTurn && !sp.usesTurnToActivate) { textToSpan += "Free action, repeatable" + "<BR>"; } else if (sp.castTimeInTurns > 0) { textToSpan += "Takes " + sp.castTimeInTurns + " full turn(s)" + "<BR>"; } if (sp.coolDownTime > 0) { textToSpan += "Cool down time: " + sp.coolDownTime + " turn(s)" + "<BR>"; } textToSpan += "SP Cost: " + sp.costSP + "<BR>"; textToSpan += "HP Cost: " + sp.costHP + "<BR>"; textToSpan += "Target Range: " + sp.range + "<BR>"; textToSpan += "Area of Effect Radius: " + sp.aoeRadius + "<BR>"; textToSpan += "Available at Level: " + getLevelAvailable(sp.tag) + "<BR>"; textToSpan += "<BR>"; textToSpan += sp.description; description.tbXloc = 11 * gv.squareSize; description.tbYloc = 2 * gv.squareSize; description.tbWidth = pW * 40; description.tbHeight = pH * 80; description.logLinesList.Clear(); description.AddHtmlTextToLog(textToSpan); description.onDrawLogBox(); } btnHelp.Draw(); btnExit.Draw(); btnSelect.Draw(); btnTokensLeft.Draw(); btnTokensRight.Draw(); btnPageIndex.Draw(); }
public void redrawJournal() { int pW = (int)((float)gv.screenWidth / 100.0f); int pH = (int)((float)gv.screenHeight / 100.0f); int locY = pH * 5; int locX = 4 * gv.squareSize; int spacing = (int)gv.drawFontRegHeight + pH; int leftStartY = pH * 4; int tabStartY = pH * 40; //IF BACKGROUND IS NULL, LOAD IMAGE if (journalBack == null) { gv.cc.DisposeOfBitmap(ref journalBack); journalBack = gv.cc.LoadBitmap("journalback"); } //IF BUTTONS ARE NULL, LOAD BUTTONS if (btnReturnJournal == null) { setControlsStart(); } //DRAW BACKGROUND IMAGE IbRect src = new IbRect(0, 0, journalBack.PixelSize.Width, journalBack.PixelSize.Height); IbRect dst = new IbRect(2 * gv.squareSize, 0, (gv.squaresInWidth - 4) * gv.squareSize, (gv.squaresInHeight - 1) * gv.squareSize); gv.DrawBitmap(journalBack, src, dst); //MAKE SURE NO OUT OF INDEX ERRORS if (gv.mod.partyJournalQuests.Count > 0) { if (journalScreenQuestIndex >= gv.mod.partyJournalQuests.Count) { journalScreenQuestIndex = 0; } if (journalScreenEntryIndex >= gv.mod.partyJournalQuests[journalScreenQuestIndex].Entries.Count) { journalScreenEntryIndex = 0; } } //DRAW QUESTS Color color = Color.Black; gv.DrawText("Active Quests:", locX, locY += leftStartY, 1.0f, color); gv.DrawText("--------------", locX, locY += spacing, 1.0f, color); //draw Faction info first bool drawFactionQuest = false; if (gv.mod.moduleFactionsList != null) { foreach (Faction f in gv.mod.moduleFactionsList) { if (f.showThisFactionInJournal) { drawFactionQuest = true; break; } } } if (drawFactionQuest) { //now add the faction quest and an entry for each drawn faction //1. No need to add the quest if it already exists bool factionQuestExistsAlready = false; foreach (JournalQuest jQ in gv.mod.partyJournalQuests) { if (jQ.Tag == "factionQuest001") { factionQuestExistsAlready = true; jQ.Entries.Clear(); break; } } if (!factionQuestExistsAlready) { JournalQuest factionQuest = new JournalQuest(); factionQuest.Tag = "factionQuest001"; factionQuest.Name = "Factions"; factionQuest.Entries.Clear(); gv.mod.partyJournalQuests.Add(factionQuest); } //2. update entries of faction quest foreach (JournalQuest jQ in gv.mod.partyJournalQuests) { if (jQ.Tag == "factionQuest001") { int idCounter = 0; foreach (Faction f in gv.mod.moduleFactionsList) { if (f.showThisFactionInJournal) { JournalEntry factionEntry = new JournalEntry(); factionEntry.EntryId = idCounter; factionEntry.EntryTitle = f.name; factionEntry.EntryText = ""; //Rank 1 (27 of 99, +1 every 24h), +4 buff to AC/toHit/Saves if (f.showRankInJournal) { if (f.displayRankInWords) { if (f.rank == 1) { factionEntry.EntryText += f.nameRank1 + " "; } else if (f.rank == 2) { factionEntry.EntryText += f.nameRank2 + " "; } else if (f.rank == 3) { factionEntry.EntryText += f.nameRank3 + " "; } else if (f.rank == 4) { factionEntry.EntryText += f.nameRank4 + " "; } else if (f.rank == 5) { factionEntry.EntryText += f.nameRank5 + " "; } else if (f.rank == 6) { factionEntry.EntryText += f.nameRank6 + " "; } else if (f.rank == 7) { factionEntry.EntryText += f.nameRank7 + " "; } else if (f.rank == 8) { factionEntry.EntryText += f.nameRank8 + " "; } else if (f.rank == 9) { factionEntry.EntryText += f.nameRank9 + " "; } else if (f.rank == 10) { factionEntry.EntryText += f.nameRank10 + " "; } } else { if (f.rank == 1) { factionEntry.EntryText += "Rank 1 "; } else if (f.rank == 2) { factionEntry.EntryText += "Rank 2 "; } else if (f.rank == 3) { factionEntry.EntryText += "Rank 3 "; } else if (f.rank == 4) { factionEntry.EntryText += "Rank 4 "; } else if (f.rank == 5) { factionEntry.EntryText += "Rank 5 "; } else if (f.rank == 6) { factionEntry.EntryText += "Rank 6 "; } else if (f.rank == 7) { factionEntry.EntryText += "Rank 7 "; } else if (f.rank == 8) { factionEntry.EntryText += "Rank 8 "; } else if (f.rank == 9) { factionEntry.EntryText += "Rank 9 "; } else if (f.rank == 9) { factionEntry.EntryText += "Rank 9 "; } else if (f.rank == 10) { factionEntry.EntryText += "Rank 10 "; } } } if ((f.showStrengthInJournal || f.showChangeRateInJournal) && (f.showRankInJournal)) { factionEntry.EntryText += "("; } if (f.showStrengthInJournal) { if (f.rank == 1) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank2.ToString(); } else if (f.rank == 2) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank3.ToString(); } else if (f.rank == 3) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank4.ToString(); } else if (f.rank == 4) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank5.ToString(); } else if (f.rank == 5) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank6.ToString(); } else if (f.rank == 6) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank7.ToString(); } else if (f.rank == 7) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank8.ToString(); } else if (f.rank == 8) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank9.ToString(); } else if (f.rank == 9) { factionEntry.EntryText += f.strength.ToString() + " of " + f.factionStrengthRequiredForRank10.ToString(); } else if (f.rank == 10) { factionEntry.EntryText += f.strength.ToString(); } } if ((f.showStrengthInJournal && !f.showChangeRateInJournal) && f.showRankInJournal) { factionEntry.EntryText += ") "; } if ((f.showChangeRateInJournal) && (f.showRankInJournal || f.showStrengthInJournal)) { if (f.showRankInJournal && f.showStrengthInJournal) { factionEntry.EntryText += ", " + f.amountOfFactionStrengthChangePerInterval.ToString() + " every " + f.intervalOfFactionStrengthChangeInHours.ToString() + "h)"; } else if (f.showRankInJournal && !f.showStrengthInJournal) { factionEntry.EntryText += f.amountOfFactionStrengthChangePerInterval.ToString() + " every " + f.intervalOfFactionStrengthChangeInHours.ToString() + "h)"; } else if (!f.showRankInJournal && f.showStrengthInJournal) { factionEntry.EntryText += ", " + f.amountOfFactionStrengthChangePerInterval.ToString() + " every " + f.intervalOfFactionStrengthChangeInHours.ToString() + "h"; } else if (f.showRankInJournal && !f.showStrengthInJournal) { factionEntry.EntryText += f.amountOfFactionStrengthChangePerInterval.ToString() + " every " + f.intervalOfFactionStrengthChangeInHours.ToString() + "h)"; } } else if (f.showChangeRateInJournal) { factionEntry.EntryText += f.amountOfFactionStrengthChangePerInterval.ToString() + " every " + f.intervalOfFactionStrengthChangeInHours.ToString() + "h"; } if (f.rank == 1) { if (f.accumulatedBuffStrengthRank1 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank1.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 2) { if (f.accumulatedBuffStrengthRank2 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank2.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 3) { if (f.accumulatedBuffStrengthRank3 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank3.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 4) { if (f.accumulatedBuffStrengthRank4 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank4.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 5) { if (f.accumulatedBuffStrengthRank5 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank5.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 6) { if (f.accumulatedBuffStrengthRank6 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank6.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 7) { if (f.accumulatedBuffStrengthRank7 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank7.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 8) { if (f.accumulatedBuffStrengthRank8 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank8.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 9) { if (f.accumulatedBuffStrengthRank9 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank9.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } else if (f.rank == 10) { if (f.accumulatedBuffStrengthRank10 != 0) { factionEntry.EntryText += ", +" + f.accumulatedBuffStrengthRank10.ToString() + " buff to AC/toHit/Saves"; //factionEntry.EntryText += "<br>"; } } factionEntry.EntryText += "<br>"; factionEntry.EntryText += "<br>"; factionEntry.EntryText += f.factionDescriptionInJournal; jQ.Entries.Add(factionEntry); idCounter++; } } break; } } } if (gv.mod.partyJournalQuests.Count > 0) { /* * int cnt = 0; * foreach (JournalQuest jq in gv.mod.partyJournalQuests) * { * if (journalScreenQuestIndex == cnt) { color = Color.Lime; } * else { color = Color.Black; } * gv.DrawText(jq.Name, locX, locY += spacing, 1.0f, color); * cnt++; * } */ int minQuestNumber = journalScreenQuestIndex - 3; int maxQuestNumber = journalScreenQuestIndex + 3; if (minQuestNumber < 0) { maxQuestNumber -= minQuestNumber; if (maxQuestNumber > gv.mod.partyJournalQuests.Count - 1) { maxQuestNumber = gv.mod.partyJournalQuests.Count - 1; } minQuestNumber = 0; } if (maxQuestNumber > gv.mod.partyJournalQuests.Count - 1) { minQuestNumber -= (maxQuestNumber - (gv.mod.partyJournalQuests.Count - 1)); if (minQuestNumber < 0) { minQuestNumber = 0; } maxQuestNumber = gv.mod.partyJournalQuests.Count - 1; } for (int i = minQuestNumber; i <= maxQuestNumber; i++) { if (journalScreenQuestIndex == i) { color = Color.Lime; } else { color = Color.Black; } gv.DrawText(gv.mod.partyJournalQuests[i].Name, locX, locY += spacing, 1.0f, color); } } //DRAW QUEST ENTRIES locY = tabStartY; gv.DrawText("Quest Entry:", locX, locY, 1.0f, Color.Black); gv.DrawText("--------------", locX, locY += spacing, 1.0f, Color.Black); if (gv.mod.partyJournalQuests.Count > 0) { //Description string textToSpan = "<font color='black'><i><b>" + gv.mod.partyJournalQuests[journalScreenQuestIndex].Entries[journalScreenEntryIndex].EntryTitle + "</b></i></font><br>"; textToSpan += gv.mod.partyJournalQuests[journalScreenQuestIndex].Entries[journalScreenEntryIndex].EntryText; string textToSpanReplaced = replaceText(textToSpan); int yLoc = pH * 18; description.tbXloc = locX; description.tbYloc = locY + spacing; description.tbWidth = pW * 60; description.tbHeight = pH * 45; description.logLinesList.Clear(); description.AddHtmlTextToLog(textToSpanReplaced); description.onDrawLogBox(); } //DRAW ALL CONTROLS ctrlUpArrow.Draw(); ctrlDownArrow.Draw(); ctrlLeftArrow.Draw(); ctrlRightArrow.Draw(); btnReturnJournal.Draw(); }