Improve and fix data internals for health/mana/pack/regen/attack ups.
Change display and restrictions on egg hunt mode.
This commit is contained in:
parent
c0e653e31c
commit
0644cd10a7
4
sessions
4
sessions
@ -1 +1,3 @@
|
||||
16,1584021695,1584022621,Trimead's Race,4,none,trimead;sigonitori,5.00,0,5,true
|
||||
19,1584088712,1584089249,SigoNitori's Race,4,none,,5.00,0,5,true
|
||||
20,1584089263,1584089710,SigoNitori's Race,4,none,,5.00,0,48,false
|
||||
21,1584089784,1584089803,SigoNitori's Race,4,none,sigonitori,5.00,0,80,true
|
||||
|
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -5,6 +5,7 @@ import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -32,12 +33,12 @@ public class Profile {
|
||||
public String displayName = sigIRC.nickname;
|
||||
public Avatar avatar;
|
||||
public int playtime = 0;
|
||||
public int healthUps = 0;
|
||||
public int attackUps = 0;
|
||||
public int manaUps = 0;
|
||||
public int regenUps = 0;
|
||||
public int packUps = 0;
|
||||
public int rainbowEggCount = 0;
|
||||
public String healthUps = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
public String attackUps = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
public String manaUps = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
public String regenUps = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
public String packUps = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
public int rainbowEggs = 0;
|
||||
public boolean isPaused = false;
|
||||
public int difficulty = 0;
|
||||
public int loop = 0;
|
||||
@ -80,7 +81,7 @@ public class Profile {
|
||||
oldProfile.manaUps = manaUps;
|
||||
oldProfile.regenUps = regenUps;
|
||||
oldProfile.packUps = packUps;
|
||||
oldProfile.rainbowEggCount = rainbowEggCount;
|
||||
oldProfile.rainbowEggs = rainbowEggs;
|
||||
oldProfile.key_items = (LinkedHashMap<MemoryData, Integer>)key_items.clone();
|
||||
oldProfile.badges = (LinkedHashMap<MemoryData, Integer>)badges.clone();
|
||||
oldProfile.playtime = playtime;
|
||||
@ -103,7 +104,7 @@ public class Profile {
|
||||
if (oldProfile.packUps!=packUps) {
|
||||
count++;
|
||||
}
|
||||
if (oldProfile.rainbowEggCount!=rainbowEggCount) {
|
||||
if (oldProfile.rainbowEggs!=rainbowEggs) {
|
||||
count++;
|
||||
}
|
||||
for (MemoryData md : key_items.keySet()) {
|
||||
@ -129,6 +130,60 @@ public class Profile {
|
||||
return count;
|
||||
}
|
||||
|
||||
public static int GetHealthUpCount(Profile p) {
|
||||
int numb = 0;
|
||||
for (int i=0;i<p.healthUps.length();i++) {
|
||||
if (p.healthUps.charAt(i)=='1') {
|
||||
numb++;
|
||||
}
|
||||
}
|
||||
return numb;
|
||||
}
|
||||
|
||||
public static int GetManaUpCount(Profile p) {
|
||||
int numb = 0;
|
||||
for (int i=0;i<p.manaUps.length();i++) {
|
||||
if (p.manaUps.charAt(i)=='1') {
|
||||
numb++;
|
||||
}
|
||||
}
|
||||
return numb;
|
||||
}
|
||||
|
||||
public static int GetRegenUpCount(Profile p) {
|
||||
int numb = 0;
|
||||
for (int i=0;i<p.regenUps.length();i++) {
|
||||
if (p.regenUps.charAt(i)=='1') {
|
||||
numb++;
|
||||
}
|
||||
}
|
||||
return numb;
|
||||
}
|
||||
|
||||
public static int GetPackUpCount(Profile p) {
|
||||
int numb = 0;
|
||||
for (int i=0;i<p.packUps.length();i++) {
|
||||
if (p.packUps.charAt(i)=='1') {
|
||||
numb++;
|
||||
}
|
||||
}
|
||||
return numb;
|
||||
}
|
||||
|
||||
public static int GetAttackUpCount(Profile p) {
|
||||
int numb = 0;
|
||||
for (int i=0;i<p.attackUps.length();i++) {
|
||||
if (p.attackUps.charAt(i)=='1') {
|
||||
numb++;
|
||||
}
|
||||
}
|
||||
return numb;
|
||||
}
|
||||
|
||||
public static int GetRainbowEggCount(Profile p) {
|
||||
return p.rainbowEggs;
|
||||
}
|
||||
|
||||
public void compareAndAnnounceAllChangedValues() {
|
||||
//System.out.println(oldProfile.key_items.get(MemoryData.HAMMER)+","+key_items.get(MemoryData.HAMMER));
|
||||
int changedValueCount = compareAllChangedValues();
|
||||
@ -136,33 +191,33 @@ public class Profile {
|
||||
return;
|
||||
}
|
||||
String announcement = "";
|
||||
if (oldProfile.healthUps==healthUps-1) {
|
||||
if (GetHealthUpCount(oldProfile)==GetHealthUpCount(this)-1) {
|
||||
announcement = "has obtained a Health Up! ("+healthUps+" total)";
|
||||
}
|
||||
if (oldProfile.attackUps==attackUps-1) {
|
||||
if (GetAttackUpCount(oldProfile)==GetAttackUpCount(this)-1) {
|
||||
announcement = "has obtained an Attack Up! ("+attackUps+" total)";
|
||||
}
|
||||
if (oldProfile.manaUps==manaUps-1) {
|
||||
if (GetManaUpCount(oldProfile)==GetManaUpCount(this)-1) {
|
||||
announcement = "has obtained a Mana Up! ("+manaUps+" total)";
|
||||
}
|
||||
if (oldProfile.regenUps==regenUps-1) {
|
||||
if (GetRegenUpCount(oldProfile)==GetRegenUpCount(this)-1) {
|
||||
announcement = "has obtained a Regen Up! ("+regenUps+" total)";
|
||||
}
|
||||
if (oldProfile.packUps==packUps-1) {
|
||||
if (GetPackUpCount(oldProfile)==GetPackUpCount(this)-1) {
|
||||
announcement = "has obtained a Pack Up! ("+packUps+" total)";
|
||||
}
|
||||
if (oldProfile.rainbowEggCount==rainbowEggCount-1) {
|
||||
if (GetRainbowEggCount(oldProfile)==GetRainbowEggCount(this)-1) {
|
||||
if (RabiRaceModule.mySession!=null &&
|
||||
RabiRaceModule.mySession.gamemode==0 &&
|
||||
RabiRaceModule.mySession.eggCount>0) {
|
||||
if (RabiRaceModule.mySession.eggCount-rainbowEggCount==0) {
|
||||
announcement = "has obtained "+RabiRaceModule.mySession.eggCount+" Rainbow Eggs! (NAME) has completed the race!";
|
||||
} else if (RabiRaceModule.mySession.eggCount-rainbowEggCount>0)
|
||||
RabiRaceModule.mySession.rainbowEggGoal>0) {
|
||||
if (RabiRaceModule.mySession.rainbowEggGoal-GetRainbowEggCount(this)==0) {
|
||||
announcement = "has obtained "+RabiRaceModule.mySession.rainbowEggGoal+" Rainbow Eggs! (NAME) has completed the race!";
|
||||
} else if (RabiRaceModule.mySession.rainbowEggGoal-GetRainbowEggCount(this)>0)
|
||||
{
|
||||
announcement = "has obtained a Rainbow Egg! ("+Math.max(RabiRaceModule.mySession.eggCount-rainbowEggCount, 0)+" to go!)";
|
||||
announcement = "has obtained a Rainbow Egg! ("+Math.max(RabiRaceModule.mySession.rainbowEggGoal-GetRainbowEggCount(this), 0)+" to go!)";
|
||||
}
|
||||
} else {
|
||||
announcement = "has obtained a Rainbow Egg! ("+rainbowEggCount+" total)";
|
||||
announcement = "has obtained a Rainbow Egg! ("+rainbowEggs+" total)";
|
||||
}
|
||||
}
|
||||
for (MemoryData md : key_items.keySet()) {
|
||||
@ -253,12 +308,12 @@ public class Profile {
|
||||
//System.out.println("Updated Avatar for Player "+displayName+" with Avatar "+avatar.displayName);
|
||||
timeKey = Integer.parseInt(data[i++]);
|
||||
playtime = Integer.parseInt(data[i++]);
|
||||
healthUps = Integer.parseInt(data[i++]);
|
||||
manaUps = Integer.parseInt(data[i++]);
|
||||
regenUps = Integer.parseInt(data[i++]);
|
||||
packUps = Integer.parseInt(data[i++]);
|
||||
attackUps = Integer.parseInt(data[i++]);
|
||||
rainbowEggCount = Integer.parseInt(data[i++]);
|
||||
healthUps = data[i++];
|
||||
manaUps = data[i++];
|
||||
regenUps = data[i++];
|
||||
packUps = data[i++];
|
||||
attackUps = data[i++];
|
||||
rainbowEggs = Integer.parseInt(data[i++]);
|
||||
isPaused = Boolean.parseBoolean(data[i++]);
|
||||
difficulty = Integer.parseInt(data[i++]);
|
||||
loop = Integer.parseInt(data[i++]);
|
||||
@ -307,7 +362,7 @@ public class Profile {
|
||||
appendData(regenUps,sb);
|
||||
appendData(packUps,sb);
|
||||
appendData(attackUps,sb);
|
||||
appendData(rainbowEggCount,sb);
|
||||
appendData(rainbowEggs,sb);
|
||||
appendData(isPaused,sb);
|
||||
appendData(difficulty,sb);
|
||||
appendData(loop,sb);
|
||||
@ -433,17 +488,25 @@ public class Profile {
|
||||
if (gamemode!=-1) {
|
||||
switch (gamemode) {
|
||||
case 0:{ //Egg Hunt.
|
||||
if (session.eggCount>0) {
|
||||
spacing = width/session.eggCount;
|
||||
rainbowEggLimit = session.eggCount;
|
||||
if (session.rainbowEggGoal>0) {
|
||||
spacing = width/session.rainbowEggGoal;
|
||||
rainbowEggLimit = session.rainbowEggGoal;
|
||||
} else {
|
||||
spacing = width/5;
|
||||
rainbowEggLimit = session.eggCount;
|
||||
rainbowEggLimit = session.rainbowEggGoal;
|
||||
}
|
||||
Image img = RabiRaceModule.image_map.get("easter_egg.png");
|
||||
for (int i=0;i<session.eggCount;i++) {
|
||||
Color col = (rainbowEggCount>i)?RabiRaceModule.rainbowcycler.getCycleColor():new Color(0,0,0,192);
|
||||
DrawUtils.drawImage(g2, img, (int)(border+i*spacing-img.getWidth(sigIRC.panel)/4),(int)(36),col,sigIRC.panel);
|
||||
if (rainbowEggLimit>10) {
|
||||
Color col = RabiRaceModule.rainbowcycler.getCycleColor();
|
||||
Rectangle2D siz = TextUtils.calculateStringBoundsFont("x "+GetRainbowEggCount(this)+" / "+session.rainbowEggGoal, sigIRC.panel.rabiRibiMoneyDisplayFont);
|
||||
DrawUtils.drawImage(g2, img, (int)(border+spacing*3-siz.getX()),(int)(36),col,sigIRC.panel);
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.panel.rabiRibiMoneyDisplayFont, (border+spacing*3+img.getWidth(sigIRC.panel)*1.25), (36+img.getHeight(sigIRC.panel)/2),
|
||||
1,Color.WHITE,Color.BLACK,"x "+GetRainbowEggCount(this)+" / "+session.rainbowEggGoal);
|
||||
} else {
|
||||
for (int i=0;i<session.rainbowEggGoal;i++) {
|
||||
Color col = (GetRainbowEggCount(this)>i)?RabiRaceModule.rainbowcycler.getCycleColor():new Color(0,0,0,192);
|
||||
DrawUtils.drawImage(g2, img, (int)(border+i*spacing-img.getWidth(sigIRC.panel)/4),(int)(36),col,sigIRC.panel);
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case 1:{ //Item Hunt.
|
||||
@ -516,17 +579,18 @@ public class Profile {
|
||||
RabiRaceModule.image_map.get("pack_up.png"),
|
||||
RabiRaceModule.image_map.get("attack_up.png")};
|
||||
int[] amts = new int[]{
|
||||
healthUps,
|
||||
manaUps,
|
||||
regenUps,
|
||||
packUps,
|
||||
attackUps,
|
||||
GetHealthUpCount(this),
|
||||
GetManaUpCount(this),
|
||||
GetRegenUpCount(this),
|
||||
GetPackUpCount(this),
|
||||
GetAttackUpCount(this),
|
||||
};
|
||||
if (rainbowEggCount>rainbowEggLimit) {
|
||||
spacing=width/6;
|
||||
if (GetRainbowEggCount(this)>rainbowEggLimit) {
|
||||
imgs = Arrays.copyOf(imgs, imgs.length+1);
|
||||
imgs[imgs.length-1] = RabiRaceModule.image_map.get("easter_egg.png");
|
||||
amts = Arrays.copyOf(amts, amts.length+1);
|
||||
amts[amts.length-1] = rainbowEggCount;
|
||||
amts[amts.length-1] = GetRainbowEggCount(this);
|
||||
spacing = width/6;
|
||||
}
|
||||
//g2.drawImage(RabiRaceModule.image_map.get("bunny_strike.png"),(int)(+border+(i++)*(spacing)-img2.getWidth(sigIRC.panel)/4),(int)(+96+56), (int)icon_size, (int)icon_size, sigIRC.panel);
|
||||
|
@ -19,7 +19,7 @@ public class Session {
|
||||
boolean coop = false;
|
||||
int gamemode = 0; //0 = Egg Mode, 1 = Item Hunt Mode
|
||||
String[] itemHuntData;
|
||||
int eggCount = 0;
|
||||
int rainbowEggGoal = 0;
|
||||
int id = 0;
|
||||
List<Profile> players = new ArrayList<Profile>();
|
||||
|
||||
@ -65,7 +65,7 @@ public class Session {
|
||||
gamemode = Integer.parseInt(split[i++]);
|
||||
switch (gamemode) {
|
||||
case 0:{
|
||||
eggCount = Integer.parseInt(split[i++]);
|
||||
rainbowEggGoal = Integer.parseInt(split[i++]);
|
||||
}break;
|
||||
case 1:{
|
||||
itemHuntData = split[i++].split(";");
|
||||
|
@ -199,8 +199,8 @@ public class SessionCreateWindow extends JFrame{
|
||||
JOptionPane.showMessageDialog(RabiRaceModule.createwindow, "Your egg count is invalid!", "Error!", JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
if (((String)gametype.getSelectedItem()).equalsIgnoreCase("Egg Mode") && (Integer.parseInt(eggcount.getText())>48 || Integer.parseInt(eggcount.getText())<2)) {
|
||||
JOptionPane.showMessageDialog(RabiRaceModule.createwindow, "Your egg count needs to be between 2-48!", "Error!", JOptionPane.WARNING_MESSAGE);
|
||||
if (((String)gametype.getSelectedItem()).equalsIgnoreCase("Egg Mode") && (Integer.parseInt(eggcount.getText())>80 || Integer.parseInt(eggcount.getText())<2)) {
|
||||
JOptionPane.showMessageDialog(RabiRaceModule.createwindow, "Your egg count needs to be between 2-80!", "Error!", JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
if (!TextUtils.isNumeric(difficulty.getText()) && difficulty.getText().length()>0) {
|
||||
@ -388,7 +388,7 @@ public class SessionCreateWindow extends JFrame{
|
||||
return true;
|
||||
}
|
||||
int val = Integer.parseInt(getText());
|
||||
if (val>48 || val<2) {
|
||||
if (val>80 || val<2) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -258,29 +258,29 @@ public class RabiRaceModule extends Module{
|
||||
updateRequired=true;
|
||||
}
|
||||
}
|
||||
if (p.healthUps>myProfile.healthUps) {
|
||||
if (Profile.GetHealthUpCount(p)>Profile.GetHealthUpCount(myProfile)) {
|
||||
System.out.println("You do not have the correct amount of health ups. Syncing to ("+p.healthUps+") from "+p.displayName+".");
|
||||
UpdateRange(MemoryOffset.HEALTHUP_START,MemoryOffset.HEALTHUP_END,p.healthUps-myProfile.healthUps);
|
||||
UpdateRange(MemoryOffset.HEALTHUP_START,MemoryOffset.HEALTHUP_END,p.healthUps);
|
||||
updateRequired=true;
|
||||
}
|
||||
if (p.manaUps>myProfile.manaUps) {
|
||||
if (Profile.GetManaUpCount(p)>Profile.GetManaUpCount(myProfile)) {
|
||||
System.out.println("You do not have the correct amount of mana ups. Syncing to ("+p.manaUps+") from "+p.displayName+".");
|
||||
UpdateRange(MemoryOffset.MANAUP_START,MemoryOffset.MANAUP_END,p.manaUps-myProfile.manaUps);
|
||||
UpdateRange(MemoryOffset.MANAUP_START,MemoryOffset.MANAUP_END,p.manaUps);
|
||||
updateRequired=true;
|
||||
}
|
||||
if (p.regenUps>myProfile.regenUps) {
|
||||
if (Profile.GetRegenUpCount(p)>Profile.GetRegenUpCount(myProfile)) {
|
||||
System.out.println("You do not have the correct amount of regen ups. Syncing to ("+p.regenUps+") from "+p.displayName+".");
|
||||
UpdateRange(MemoryOffset.REGENUP_START,MemoryOffset.REGENUP_END,p.regenUps-myProfile.regenUps);
|
||||
UpdateRange(MemoryOffset.REGENUP_START,MemoryOffset.REGENUP_END,p.regenUps);
|
||||
updateRequired=true;
|
||||
}
|
||||
if (p.packUps>myProfile.packUps) {
|
||||
if (Profile.GetPackUpCount(p)>Profile.GetPackUpCount(myProfile)) {
|
||||
System.out.println("You do not have the correct amount of pack ups. Syncing to ("+p.packUps+") from "+p.displayName+".");
|
||||
UpdateRange(MemoryOffset.PACKUP_START,MemoryOffset.PACKUP_END,p.packUps-myProfile.packUps);
|
||||
UpdateRange(MemoryOffset.PACKUP_START,MemoryOffset.PACKUP_END,p.packUps);
|
||||
updateRequired=true;
|
||||
}
|
||||
if (p.attackUps>myProfile.attackUps) {
|
||||
if (Profile.GetAttackUpCount(p)>Profile.GetAttackUpCount(myProfile)) {
|
||||
System.out.println("You do not have the correct amount of attack ups. Syncing to ("+p.attackUps+") from "+p.displayName+".");
|
||||
UpdateRange(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END,p.attackUps-myProfile.attackUps);
|
||||
UpdateRange(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END,p.attackUps);
|
||||
updateRequired=true;
|
||||
}
|
||||
|
||||
@ -295,14 +295,19 @@ public class RabiRaceModule extends Module{
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateRange(MemoryOffset start, MemoryOffset end, int i) {
|
||||
int f=63;
|
||||
private void UpdateRange(MemoryOffset start, MemoryOffset end, String i) {
|
||||
/*int f=63;
|
||||
while (i>0 && f>0) {
|
||||
if (readIntFromMemory(start.getOffset())==0) {
|
||||
writeIntToMemory(start.getOffset()+(f*4),1);
|
||||
i--;
|
||||
}
|
||||
f--;
|
||||
}*/
|
||||
for (int l=0;l<i.length();l++) {
|
||||
if (i.charAt(l)=='1') {
|
||||
writeIntToMemory(start.getOffset()+(l*4),1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,7 +416,7 @@ public class RabiRaceModule extends Module{
|
||||
//System.out.println(itempct+","+paused);
|
||||
if (paused==0 && itempct>=0) {
|
||||
myProfile.archiveAllValues();
|
||||
myProfile.rainbowEggCount = readIntFromMemory(MemoryOffset.RAINBOW_EGG_COUNT);
|
||||
myProfile.rainbowEggs = readIntFromMemory(MemoryOffset.RAINBOW_EGG_COUNT);
|
||||
myProfile.attackUps = readItemCountFromMemory(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END);
|
||||
myProfile.healthUps = readItemCountFromMemory(MemoryOffset.HEALTHUP_START,MemoryOffset.HEALTHUP_END);
|
||||
myProfile.manaUps = readItemCountFromMemory(MemoryOffset.MANAUP_START,MemoryOffset.MANAUP_END);
|
||||
@ -549,15 +554,13 @@ public class RabiRaceModule extends Module{
|
||||
}
|
||||
}
|
||||
|
||||
int readItemCountFromMemory(MemoryOffset start_range,
|
||||
String readItemCountFromMemory(MemoryOffset start_range,
|
||||
MemoryOffset end_range) {
|
||||
int count=0;
|
||||
for (long i=start_range.getOffset();i<=end_range.getOffset();i++) {
|
||||
if (readIntFromMemory(i)==1) {
|
||||
count++;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (long i=start_range.getOffset();i<=end_range.getOffset();i+=4) {
|
||||
sb.append(readIntFromMemory(i));
|
||||
}
|
||||
return count;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void draw(Graphics g) {
|
||||
|
44
tmp_profile
44
tmp_profile
@ -1,19 +1,37 @@
|
||||
SigoNitori
|
||||
10
|
||||
1584022486
|
||||
5181
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
false
|
||||
1584089765
|
||||
965854
|
||||
1101111100010000001010000000000000000000000000000000000000011111
|
||||
1011000000000000010000001000000000000000000000000000000000011111
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0100000000000000000000000000000000000000000000000000000000011110
|
||||
0101100111111101010000000000000000000000000000000000000000011111
|
||||
21
|
||||
true
|
||||
5
|
||||
1
|
||||
1
|
||||
0.0
|
||||
0.0
|
||||
1584022627
|
||||
25.666666
|
||||
40.846153
|
||||
1584089809
|
||||
KEYITEMS:
|
||||
AIR_JUMP;1
|
||||
SLIDING_POWDER;1
|
||||
CARROT_BOMB;1
|
||||
SPEED_BOOST;1
|
||||
RIBBON;1
|
||||
RABI_SLIPPERS;1
|
||||
QUICK_BARRETTE;1
|
||||
LIGHT_ORB;1
|
||||
SUNNY_BEAM;1
|
||||
BUNNY_STRIKE;1
|
||||
BUNNY_AMULET;3
|
||||
WATER_ORB;1
|
||||
SUPER_CARROT;3
|
||||
GOLD_CARROT;1
|
||||
BADGES:
|
||||
BADGE_TOXIC_STRIKE;2
|
||||
BADGE_SURVIVAL;2
|
||||
BADGE_ATK_TRADE;2
|
||||
BADGE_PURE_LOVE;2
|
||||
UPDATES:
|
Loading…
x
Reference in New Issue
Block a user