Skip to content

Commit 7ae4350

Browse files
authored
Merge pull request #132 from gasti-jm/cambios_gasty
Agrego sistema de modo seguro, seguro de resu. Tambien solucione algu…
2 parents 6b392f0 + dc06c5e commit 7ae4350

15 files changed

Lines changed: 254 additions & 17 deletions

File tree

2.96 KB
Loading

resources/gui.ao

2.56 KB
Binary file not shown.

resources/keys.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Key Configuration for Argentum Online LWJGL3
22
#Mapping actions to GLFW keycodes
3-
#Tue Jun 02 18:28:56 ART 2026
3+
#Wed Aug 19 18:01:15 ART 2026
44
ATTACK=341
55
AUTO_MOVE=258
66
CAST_SPELL_MACRO=296
@@ -24,7 +24,7 @@ TOGGLE_FXS=70
2424
TOGGLE_MUSIC=77
2525
TOGGLE_NAMES=78
2626
TOGGLE_RESUSCITATION_SAFE=269
27-
TOGGLE_SAFE_MODE=332
27+
TOGGLE_SAFE_MODE=67
2828
TOGGLE_SOUND=290
2929
UP=87
3030
USE_OBJECT=32

resources/strings_en.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ MENSAJE_CRIATURA_MATADO = You have blocked the attack with your shield!!!
33
MENSAJE_RECHAZO_ATAQUE_ESCUDO = The user has blocked the attack with their shield!!!
44
MENSAJE_USUARIO_RECHAZO_ATAQUE_ESCUDO = You have missed the attack!!!
55
MENSAJE_FALLADO_GOLPE = You have missed the attack!!!
6-
MENSAJE_SEGURO_ACTIVADO = >>SAFETY ENABLED<<
7-
MENSAJE_SEGURO_DESACTIVADO = >>SAFETY DISABLED<<
6+
MENSAJE_SEGURO_ACTIVADO = SAFETY ENABLED
7+
MENSAJE_SEGURO_DESACTIVADO = SAFETY DISABLED
88
MENSAJE_PIERDE_NOBLEZA = You have lost nobility points and gained infamy points!! If you continue helping criminals, you will become one and you will be hunted by the city guards.
99
MENSAJE_USAR_MEDITANDO = You are meditating! You must stop meditating to use items.
1010
MENSAJE_SEGURO_RESU_ON = RESURRECTION SAFETY ENABLED

resources/strings_es.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ MENSAJE_CRIATURA_MATADO = Has rechazado el ataque con el escudo!!!
33
MENSAJE_RECHAZO_ATAQUE_ESCUDO = El usuario rechazó el ataque con su escudo!!!
44
MENSAJE_USUARIO_RECHAZO_ATAQUE_ESCUDO = Has fallado el golpe!!!
55
MENSAJE_FALLADO_GOLPE = Has fallado el golpe!!!
6-
MENSAJE_SEGURO_ACTIVADO = >>SEGURO ACTIVADO<<
7-
MENSAJE_SEGURO_DESACTIVADO = >>SEGURO DESACTIVADO<<
6+
MENSAJE_SEGURO_ACTIVADO = SEGURO ACTIVADO
7+
MENSAJE_SEGURO_DESACTIVADO = SEGURO DESACTIVADO
88
MENSAJE_PIERDE_NOBLEZA = Has perdido puntaje de nobleza y ganado puntaje de criminalidad!! Si sigues ayudando a criminales te convertirás en uno de ellos y serás perseguido por las tropas de las ciudades.
99
MENSAJE_USAR_MEDITANDO = ¡Estás meditando! Debes dejar de meditar para usar objetos.
1010
MENSAJE_SEGURO_RESU_ON = SEGURO DE RESURRECCION ACTIVADO

src/main/java/org/aoclient/engine/game/Rain.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public enum Rain {
6767
TextureManager.requestTextureFile(RAIN_FILE_NUM_GRAPHIC);
6868
}
6969

70+
// TODO: Hay que meter esto en un archivo.
7071
private void loadData() {
7172
// Set up te rain rects
7273
for (int i = 0; i < 8; i++)
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
package org.aoclient.engine.game;
2+
3+
import imgui.ImGui;
4+
import org.aoclient.engine.game.console.Console;
5+
import org.aoclient.engine.game.console.FontStyle;
6+
import org.aoclient.engine.game.models.SMType;
7+
import org.aoclient.engine.renderer.RGBColor;
8+
import org.aoclient.engine.renderer.Texture;
9+
import org.aoclient.engine.renderer.TextureManager;
10+
11+
import static org.aoclient.engine.audio.Sound.SND_CLICK;
12+
import static org.aoclient.engine.audio.Sound.playSound;
13+
import static org.aoclient.engine.gui.forms.Form.imageButtonRegion;
14+
import static org.aoclient.engine.gui.forms.Form.imageRegion;
15+
import static org.aoclient.engine.utils.GameData.grhData;
16+
import static org.aoclient.network.protocol.Protocol.resucitationToggle;
17+
import static org.aoclient.network.protocol.Protocol.safeToggle;
18+
19+
// lo creamos en fMAIN
20+
public class SMSystem {
21+
private final int x, y, w, h; // posicion y size del boton
22+
private final SMType type;
23+
private boolean active;
24+
private Texture SMTex;
25+
26+
public SMSystem(int x, int y, SMType type, boolean active) {
27+
this.x = x;
28+
this.y = y;
29+
this.w = 28;
30+
this.h = 30;
31+
32+
this.type = type;
33+
this.active = active;
34+
35+
// precargamos la textura
36+
TextureManager.requestTexture(type.getGrhIndexON());
37+
TextureManager.requestTexture(type.getGrhIndexOFF());
38+
39+
if (active) {
40+
SMTex = TextureManager.getTexture(grhData[type.getGrhIndexON()].getFileNum());
41+
} else {
42+
SMTex = TextureManager.getTexture(grhData[type.getGrhIndexOFF()].getFileNum());
43+
}
44+
}
45+
46+
// dibuajamos en imgui.
47+
public void draw() {
48+
// que grhindex tenemos que mostrar?
49+
final int currentGrh = active? type.getGrhIndexON() : type.getGrhIndexOFF();
50+
51+
// mostramos una imagen primero
52+
ImGui.setCursorPos(x, y);
53+
if (SMTex != null) {
54+
imageRegion(SMTex, grhData[currentGrh].getsX(), grhData[currentGrh].getsY(), w, h);
55+
}
56+
57+
ImGui.setCursorPos(x, y);
58+
if (ImGui.invisibleButton(type.toString(), w, h)) {
59+
action();
60+
}
61+
62+
// update texture
63+
SMTex = TextureManager.getTexture(grhData[currentGrh].getFileNum());
64+
65+
updateToolTip();
66+
}
67+
68+
69+
70+
private void updateToolTip() {
71+
switch (type) {
72+
case sResucitation:
73+
if (active){
74+
if (ImGui.isItemHovered()) ImGui.setTooltip(Messages.get(Messages.MessageKey.SEGURO_RESU_ON));
75+
} else {
76+
if (ImGui.isItemHovered()) ImGui.setTooltip(Messages.get(Messages.MessageKey.SEGURO_RESU_OFF));
77+
}
78+
break;
79+
80+
case sSafemode:
81+
if (active){
82+
if (ImGui.isItemHovered()) ImGui.setTooltip(Messages.get(Messages.MessageKey.SEGURO_ACTIVADO));
83+
} else {
84+
if (ImGui.isItemHovered()) ImGui.setTooltip(Messages.get(Messages.MessageKey.SEGURO_DESACTIVADO));
85+
}
86+
break;
87+
88+
}
89+
}
90+
91+
// accion segun el tipo que sea.
92+
private void action() {
93+
// sonido
94+
playSound(SND_CLICK);
95+
96+
// accion segun el tipo
97+
switch (type){
98+
case sResucitation:
99+
// el servidor ya devuelve mensaje.
100+
resucitationToggle();
101+
break;
102+
103+
case sSafemode:
104+
// el servidor ya devuelve mensaje.
105+
safeToggle();
106+
break;
107+
108+
// TODO: Agregar al sistema de internacionalizacion, no puede quedar hardcodeado esto.
109+
case mWork:
110+
if (active) {
111+
Console.INSTANCE.addMsgToConsole("Macro de trabajo desactivado.", FontStyle.BOLD, new RGBColor(1, 0, 0));
112+
} else {
113+
Console.INSTANCE.addMsgToConsole("Macro de trabajo activado.", FontStyle.BOLD, new RGBColor(0, 1, 0));
114+
}
115+
break;
116+
117+
case mSpells:
118+
if (active) {
119+
Console.INSTANCE.addMsgToConsole("Macro de hechizos desactivado.", FontStyle.BOLD, new RGBColor(1, 0, 0));
120+
} else {
121+
Console.INSTANCE.addMsgToConsole("Macro de hechizos activado.", FontStyle.BOLD, new RGBColor(0, 1, 0));
122+
}
123+
break;
124+
125+
}
126+
127+
active = !active;
128+
}
129+
130+
public void setActive(boolean active) {
131+
this.active = active;
132+
}
133+
}

src/main/java/org/aoclient/engine/game/User.java

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@
4040
public enum User {
4141
INSTANCE;
4242

43+
class UserFlags {
44+
boolean connected;
45+
boolean moving;
46+
boolean underCeiling;
47+
boolean navegating;
48+
boolean shopping;
49+
}
50+
51+
class UserData {
52+
short charIndex;
53+
short map;
54+
}
55+
4356
private final UserInventory userInventory;
4457
private final InventorySpells inventorySpells;
4558
private final Position userPos;
@@ -50,7 +63,7 @@ public enum User {
5063
private boolean userComerciando;
5164
// mapa
5265
private short userMap;
53-
private short userCharIndex;
66+
private short userCharIndex; // nosotros como usuario
5467

5568
// conexion
5669
private boolean userConected;
@@ -85,7 +98,7 @@ public enum User {
8598

8699
private String userWeaponEqpHit = "0/0";
87100
private String userArmourEqpDef = "0/0";
88-
private String userHelmEqpDef = "0/0";
101+
private String userHelmEqpDef = "0/0";
89102
private String userShieldEqpDef = "0/0";
90103

91104
private int userWeaponEqpSlot;
@@ -103,6 +116,9 @@ public enum User {
103116

104117
private int privilege;
105118

119+
private SMSystem SMResu, SMSafe, SMSpells, SMWork;
120+
121+
106122
User() {
107123
this.userPos = new Position();
108124
this.addToUserPos = new Position();
@@ -111,6 +127,12 @@ public enum User {
111127
this.talking = false;
112128
this.userNavegando = false;
113129
this.userComerciando = false;
130+
131+
// default.
132+
SMResu = new SMSystem(682, 564, SMType.sResucitation, false);
133+
SMSafe = new SMSystem(707, 564, SMType.sSafemode, true);
134+
SMSpells = new SMSystem(731, 564, SMType.mSpells, false);
135+
SMWork = new SMSystem(755, 564, SMType.mWork, false);
114136
}
115137

116138
public void resetGameState() {
@@ -235,6 +257,7 @@ public boolean estaPCarea(int charIndex) {
235257
}
236258

237259
public boolean hayAgua(int x, int y) {
260+
// TODO: esto esta hardcodeado, hay que modificarlo.
238261
return ((mapData[x][y].getLayer(1).getGrhIndex() >= 1505 && mapData[x][y].getLayer(1).getGrhIndex() <= 1520) ||
239262
(mapData[x][y].getLayer(1).getGrhIndex() >= 5665 && mapData[x][y].getLayer(1).getGrhIndex() <= 5680) ||
240263
(mapData[x][y].getLayer(1).getGrhIndex() >= 13547 && mapData[x][y].getLayer(1).getGrhIndex() <= 13562)) &&
@@ -751,4 +774,21 @@ private boolean moveToLegalPos(int x, int y) {
751774

752775
return true;
753776
}
777+
778+
779+
public SMSystem getSMResu() {
780+
return SMResu;
781+
}
782+
783+
public SMSystem getSMSafe() {
784+
return SMSafe;
785+
}
786+
787+
public SMSystem getSMSpells() {
788+
return SMSpells;
789+
}
790+
791+
public SMSystem getSMWork() {
792+
return SMWork;
793+
}
754794
}

src/main/java/org/aoclient/engine/game/bindkeys/actions/ToggleResuscitationSafe.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import org.aoclient.engine.utils.Log;
55
import org.tinylog.Logger;
66

7+
import static org.aoclient.network.protocol.Protocol.resucitationToggle;
8+
79
public class ToggleResuscitationSafe implements KeyAction {
810
@Override
911
public void action() {
10-
Log.err("Key - ToggleResuscitationSafe: No implementado.");
12+
resucitationToggle();
1113
}
1214
}

src/main/java/org/aoclient/engine/game/bindkeys/actions/ToggleSafeMode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import org.aoclient.engine.utils.Log;
55
import org.tinylog.Logger;
66

7+
import static org.aoclient.network.protocol.Protocol.safeToggle;
8+
79
public class ToggleSafeMode implements KeyAction {
810
@Override
911
public void action() {
10-
Log.err("Key - ToggleSafeMode: No implementado.");
12+
safeToggle();
1113
}
1214
}

0 commit comments

Comments
 (0)