diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index e87a7d0f..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms - -ko_fi: finisterra diff --git a/.travis.yml b/.travis.yml index 73d253cb..1465937a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,5 @@ jdk: - openjdk12 script: + - ./gradlew clean - ./gradlew compileJava diff --git a/client/src/game/managers/AOInputProcessor.java b/client/src/game/managers/AOInputProcessor.java index e0b66286..54cf4699 100644 --- a/client/src/game/managers/AOInputProcessor.java +++ b/client/src/game/managers/AOInputProcessor.java @@ -163,6 +163,24 @@ private void doActions(int keycode) { // Toggle between Windowed Mode and Fullscreen. gui.toggleFullscreen(); break; + case Input.Keys.NUM_1: + useq(0); + break; + case Input.Keys.NUM_2: + useq(1); + break; + case Input.Keys.NUM_3: + useq(2); + break; + case Input.Keys.NUM_4: + useq(3); + break; + case Input.Keys.NUM_5: + useq(4); + break; + case Input.Keys.NUM_6: + useq(5); + break; } } @@ -208,6 +226,43 @@ private void doAlternativeActions(int keycode) { // Toggle between Windowed Mode and Fullscreen. gui.toggleFullscreen(); break; + case Input.Keys.NUM_1: + useq(0); + break; + case Input.Keys.NUM_2: + useq(1); + break; + case Input.Keys.NUM_3: + useq(2); + break; + case Input.Keys.NUM_4: + useq(3); + break; + case Input.Keys.NUM_5: + useq(4); + break; + case Input.Keys.NUM_6: + useq(5); + break; + } + } + + private void useq(int x) { + int base; + if (Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT) || Gdx.input.isKeyPressed(Input.Keys.SHIFT_RIGHT )) { + if (gui.getActionBar ().getState().equals("INVENTORY")) { + if (gui.getInventory ( ).getSelected ( ).isEmpty ( )) { + base = 0; + } else { + base = gui.getInventory ( ).selectedIndex ( ); + } + gui.getInventoryQuickBar ( ).addItemsIQB ( base, x ); + } + if (gui.getActionBar ().getState().equals("SPELL")) { + gui.getSpellView ( ).addSpelltoSpellview ( gui.getSpellViewExpanded ( ).getSelected ( ), x ); + } + } else { + GameScreen.getClient().sendToAll(new ItemActionRequest(gui.getInventoryQuickBar ().getGBases(x))); } } @@ -261,11 +316,13 @@ private void toggleMeditate() { } private void toggleInventory() { - gui.getInventory().setVisible(!gui.getInventory().isVisible()); + gui.getInventoryQuickBar ().setVisible(!gui.getInventoryQuickBar ().isVisible()); + gui.getActionBar ().setExpandButtonVisible(); } private void toggleSpells() { gui.getSpellView().setVisible(!gui.getSpellView().isVisible()); + gui.getActionBar ().setExpandButtonVisible(); } } diff --git a/client/src/game/screens/GameScreen.java b/client/src/game/screens/GameScreen.java index e1546948..812d7eb4 100755 --- a/client/src/game/screens/GameScreen.java +++ b/client/src/game/screens/GameScreen.java @@ -79,6 +79,8 @@ public static void setPlayer(int player) { GameScreen.player = player; world.getSystem(GUI.class).getInventory().updateUserInventory(0); world.getSystem(GUI.class).getSpellView().updateSpells(); + world.getSystem(GUI.class).getSpellViewExpanded ().updateSpells(); + } public static KryonetClientMarshalStrategy getClient() { diff --git a/client/src/game/ui/ActionBar.java b/client/src/game/ui/ActionBar.java index 72c647a2..fb7350e7 100755 --- a/client/src/game/ui/ActionBar.java +++ b/client/src/game/ui/ActionBar.java @@ -1,18 +1,27 @@ package game.ui; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.actions.VisibleAction; +import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import game.ui.SwitchButtons.ActionSwitchListener; import game.ui.SwitchButtons.State; import game.utils.Skins; + public class ActionBar extends Table implements ActionSwitchListener { private static final float PAD_TOP = -17f; private final ClickListener mouseListener; private SwitchButtons buttons; private SpellView spellView; + private SpellViewExpanded spellViewExpanded; private Inventory inventory; + private InventoryQuickBar inventoryQuickBar; + private ImageTextButton expandButton; + private String currentState = "INVENTORY"; ActionBar() { super(Skins.COMODORE_SKIN); @@ -22,9 +31,29 @@ public class ActionBar extends Table implements ActionSwitchListener { buttons.addListener(mouseListener); spellView = new SpellView(); inventory = new Inventory(); + inventoryQuickBar =new InventoryQuickBar (); + spellViewExpanded = new SpellViewExpanded (); + expandButton = new ImageTextButton ("-", Skins.COMODORE_SKIN, "inventory-expand-collapse"); + expandButton.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + getInventory ().setVisible(!getInventory ().isVisible ()); + getSpellViewExpanded ().setVisible ( !getSpellViewExpanded ().isVisible () ); + if (getInventory ().isVisible ()){ + expandButton.setText ( "-" ); + }else{ + expandButton.setText ( "+" ); + } + + } + }); - add(buttons).top().row(); + add().top(); + add(buttons).top().right ().row(); add(inventory).padTop(PAD_TOP); + add( inventoryQuickBar ).padTop(PAD_TOP).right ().row (); + add().top(); + add( expandButton ).right ().padTop (-10f); } @Override @@ -32,19 +61,31 @@ public void notify(State state) { switch (state) { case SPELLS: clear(); + add().top(); add(buttons).top().right().row(); - add(spellView).padTop(PAD_TOP).right(); + add( spellViewExpanded ).padTop(PAD_TOP).right (); + add(spellView).padTop(PAD_TOP).right().row (); + add(); + add( expandButton ).padTop (-10f).right (); + expandButton.setVisible(spellView.isVisible ()); + currentState = "SPELL"; break; case INVENTORY: clear(); - add(buttons).top().row(); - add(inventory).padTop(PAD_TOP); + add().top(); + add(buttons).top().right ().row(); + add(inventory).padTop(PAD_TOP).right (); + add( inventoryQuickBar ).padTop(PAD_TOP).right ().row (); + add(); + add( expandButton ).padTop (-10f).right () ; + expandButton.setVisible(inventoryQuickBar.isVisible ()); + currentState = "INVENTORY"; break; } } public boolean isOver() { - return getInventory().isOver() || getSpellView().isOver() || mouseListener.isOver(); + return getInventory().isOver() || getSpellView().isOver() || getInventoryQuickBar ().isOver() || getSpellViewExpanded ().isOver () || mouseListener.isOver() || expandButton.isOver (); } public void toggle() { @@ -59,6 +100,15 @@ protected SpellView getSpellView() { return spellView; } + public InventoryQuickBar getInventoryQuickBar() { + return inventoryQuickBar; + } + + public SpellViewExpanded getSpellViewExpanded(){ + return spellViewExpanded; + } + + public void scrolled(int amount) { if (getInventory().isOver()) { getInventory().scrolled(amount); @@ -66,4 +116,12 @@ public void scrolled(int amount) { // TODO } } + + public void setExpandButtonVisible() { + expandButton.setVisible (!expandButton.isVisible ()); + } + + public String getState() { + return currentState; + } } diff --git a/client/src/game/ui/GUI.java b/client/src/game/ui/GUI.java index e349c275..1b2def1e 100755 --- a/client/src/game/ui/GUI.java +++ b/client/src/game/ui/GUI.java @@ -57,6 +57,9 @@ public ActionBar getActionBar() { public Inventory getInventory() { return actionBar.getInventory(); } + public InventoryQuickBar getInventoryQuickBar() { + return actionBar.getInventoryQuickBar (); + } public DialogText getDialog() { return dialog; @@ -78,6 +81,10 @@ public SpellView getSpellView() { return getActionBar().getSpellView(); } + public SpellViewExpanded getSpellViewExpanded(){ + return getActionBar ().getSpellViewExpanded (); + } + public void takeScreenshot() { AOAssetManager assetManager = AOGame.getGlobalAssetManager(); String screenshotPath = "Screenshots/Screenshot-" + LocalDateTime.now() + ".png"; @@ -149,7 +156,7 @@ private Table createUserStatus(Table table) { private Table createActionBar(Table table) { actionBar = new ActionBar(); - table.add(actionBar).right().expandY(); + table.add(actionBar).right().expandY().expandX (); return actionBar; } diff --git a/client/src/game/ui/Inventory.java b/client/src/game/ui/Inventory.java index 144ad2bc..c9afdedd 100755 --- a/client/src/game/ui/Inventory.java +++ b/client/src/game/ui/Inventory.java @@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.scenes.scene2d.InputEvent; -import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Window; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import entity.character.info.Inventory.Item; @@ -18,6 +17,8 @@ import shared.network.inventory.InventoryUpdate; import shared.network.inventory.ItemActionRequest; import shared.objects.types.Obj; +import shared.objects.types.SpellObj; +import shared.objects.types.Type; import java.util.ArrayList; import java.util.Optional; @@ -27,28 +28,33 @@ public class Inventory extends Window { - static final int COLUMNS = 6; - private static final int ROWS = 1; + static final int COLUMNS = 5; + private static final int ROWS = 4; private static final int SIZE = COLUMNS * ROWS; private final ClickListener mouseListener; private int base; + private GUI gui; private ArrayList slots; private Optional selected = Optional.empty(); private Optional dragging = Optional.empty(); private Optional origin = Optional.empty(); + private InventoryQuickBar inventoryQuickBar; Inventory() { super("", Skins.COMODORE_SKIN, "inventory"); + int columnsCounter = 1; setMovable(false); slots = new ArrayList<>(); for (int i = 0; i < SIZE; i++) { Slot newSlot = new Slot(); slots.add(newSlot); - add(slots.get(i)).width(Slot.SIZE).height(Slot.SIZE).row(); - if (i < SIZE - 1) { - add(new Image(getSkin().getDrawable("separator"))).row(); + add(slots.get(i)).width(Slot.SIZE).height(Slot.SIZE); + if (columnsCounter > ROWS -1) { + row(); + columnsCounter = 0; } + columnsCounter++; } mouseListener = getMouseListener(); addListener(mouseListener); @@ -72,6 +78,7 @@ public void clicked(InputEvent event, float x, float y) { slot.getItem().ifPresent(item -> { if (getTapCount() >= 2) { GameScreen.getClient().sendToAll(new ItemActionRequest(slots.indexOf(slot))); + addSpellSVE(slot); } }); }); @@ -187,12 +194,28 @@ public Optional getSelected() { public int selectedIndex() { assert (selected.isPresent()); - return slots.indexOf(selected.get()); + return base + slots.indexOf(selected.get()); } private int draggingIndex() { assert (dragging.isPresent()); - return slots.indexOf(dragging.get()); + return base + slots.indexOf(dragging.get()); + } + + + private void addSpellSVE(Slot slot){ //funcion provisoria hasta q encuentre como hacerlo a desde el servidor + Optional< Item > item = slot.getItem (); + int objID = item.map ( item1 -> item1.objId ).orElse ( -1 ); + ObjectHandler objectHandler = WorldUtils.getWorld().orElse(null).getSystem(ObjectHandler.class); + Optional object = objectHandler.getObject(objID); + object.ifPresent(obj -> { + if (obj.getType().equals (Type.SPELL)) { + SpellObj spellObj = (SpellObj) obj; + if (E (GameScreen.getPlayer ()).charHeroHeroId () != 0 ) { + GameScreen.world.getSystem (GUI.class).getSpellViewExpanded ().newSpellAdd (spellObj.getSpellIndex ()); + } + } + }); } public boolean isOver() { diff --git a/client/src/game/ui/InventoryQuickBar.java b/client/src/game/ui/InventoryQuickBar.java new file mode 100644 index 00000000..a79408da --- /dev/null +++ b/client/src/game/ui/InventoryQuickBar.java @@ -0,0 +1,124 @@ +package game.ui; + +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import entity.character.info.Inventory.Item; +import game.screens.GameScreen; +import game.utils.Skins; +import shared.network.inventory.ItemActionRequest; + +import java.util.ArrayList; +import java.util.Optional; +import java.util.stream.Stream; + +import static com.artemis.E.E; + +public class InventoryQuickBar extends Window { + + static final int COLUMNS = 6; + private static final int ROWS = 1; + private static final int SIZE = COLUMNS * ROWS; + private final ClickListener mouseListener; + + + private ArrayList slotsq; + private Optional selected = Optional.empty(); + private ArrayList gBases; + + InventoryQuickBar() { + super("", Skins.COMODORE_SKIN, "inventory"); + setMovable(false); + slotsq = new ArrayList<>(); + + for (int i = 0; i < SIZE; i++) { + Slot nuevoSlot = new Slot(); + slotsq.add(nuevoSlot); + add(slotsq.get(i)).width(Slot.SIZE).height(Slot.SIZE).row(); + if (i < SIZE - 1) { + add(new Image(getSkin().getDrawable("separator"))).row(); + } + + } + mouseListener = getMouseListener(); + addListener(mouseListener); + gBases = new ArrayList(); + for (int i = 0; i < 6; i++){ + gBases.add(i); + } + } + + private ClickListener getMouseListener() { + return new ClickListener ( ) { + + @Override + public void clicked(InputEvent event, float x, float y) { + selected.ifPresent ( slot -> slot.setSelected ( false ) ); + selected = getSlot ( x, y ); + selected.ifPresent ( slot -> { + slot.setSelected ( true ); + slot.getItem ( ).ifPresent ( item -> { + GameScreen.getClient ( ).sendToAll ( new ItemActionRequest (gBases.get (slotsq.indexOf (slot)))); + } ); + } ); + + + } + + private Optional< Slot > getSlot(float x, float y) { + return Stream.of ( getChildren ( ).items ) + .filter ( Slot.class::isInstance ) + .filter ( actor -> { + if (x > actor.getX ( ) && x < actor.getWidth ( ) + actor.getX ( )) { + return y > actor.getY ( ) && y < actor.getHeight ( ) + actor.getY ( ); + } + return false; + } ) + .map ( Slot.class::cast ).findFirst ( ); + } + final void swap(T[] a, int i, int j) { + T t = a[i]; + a[i] = a[j]; + a[j] = t; + } + + }; + } + + + + public void addItemsIQB(int base, int x) { + Item[] userItems = E(GameScreen.getPlayer()).getInventory().items; + Item item = base < userItems.length ? userItems[base] : null; + + if (x>0 && x<6){ + slotsq.get(x).setItem(item); + gBases.set(x, base); + x++; + } else{ + x = 0; + slotsq.get(x).setItem(item); + gBases.set(x, base); + x++; + } + } + + public int getGBases(int x) { + return gBases.get(x); + } + + public Optional getSelected() { + return selected; + } + + public int selectedIndex() { + assert (selected.isPresent()); + return slotsq.indexOf(selected.get()); + } + + public boolean isOver() { + return mouseListener.isOver(); + } + +} diff --git a/client/src/game/ui/SpellSlot.java b/client/src/game/ui/SpellSlot.java index 684cb9ec..2fcb417f 100755 --- a/client/src/game/ui/SpellSlot.java +++ b/client/src/game/ui/SpellSlot.java @@ -118,10 +118,7 @@ public boolean isOver() { } private Texture getSpellIcon() { - if (icon == null) { - icon = new Texture(Gdx.files.local(Resources.GAME_SPELL_ICONS_PATH + spell.getIconGrh() + ".png")); - } + icon = new Texture(Gdx.files.local(Resources.GAME_SPELL_ICONS_PATH + spell.getId () + ".png")); return icon; } - } diff --git a/client/src/game/ui/SpellSlotEC.java b/client/src/game/ui/SpellSlotEC.java new file mode 100644 index 00000000..13ee9126 --- /dev/null +++ b/client/src/game/ui/SpellSlotEC.java @@ -0,0 +1,126 @@ +package game.ui; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.ui.*; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.scenes.scene2d.utils.Drawable; +import game.utils.Resources; +import game.utils.Skins; +import shared.model.Spell; + +public class SpellSlotEC extends ImageButton { + + static final int SIZE = 64; + private static final float ICON_ALPHA = 0.5f; + private static Drawable selection = Skins.COMODORE_SKIN.getDrawable("slot-selected2"); + private final SpellViewExpanded spellViewExpanded; + private final ClickListener clickListener; + private Spell spell; + private Texture icon; + private Tooltip tooltip; + + SpellSlotEC(SpellViewExpanded spellViewExpanded, Spell spell) { + super(Skins.COMODORE_SKIN, "icon-container"); + this.spellViewExpanded = spellViewExpanded; + clickListener = new ClickListener() { + + @Override + public void touchUp(InputEvent event, float x, float y, int pointer, int button) { + super.touchUp(event, x, y, pointer, button); + onClick(); + } + }; + addListener(clickListener); + } + + public void setSpell(Spell spell) { + this.spell = spell; + if (spell == null) { + return; + } + if (tooltip != null) { + removeListener(tooltip); + } + tooltip = getTooltip(spell); + addListener(tooltip); + } + + private Tooltip getTooltip(Spell spell) { + Actor content = createTooltipContent(spell); + return new Tooltip(content); + } + + private Actor createTooltipContent(Spell spell) { + String name = spell.getName(); + String desc = spell.getDesc(); + int minhp = spell.getMinHP(); + int maxhp = spell.getMaxHP(); + int requiredMana = spell.getRequiredMana(); + int requiredSkills = spell.getMinSkill(); + + Table table = new Window("", Skins.COMODORE_SKIN); + + table.pad(0, 10, 10, 0); + table.add // LabelNombre + (new Label(name, Skins.COMODORE_SKIN, "title-no-background")) + .left().pad(10, 15, 10, 10).row(); + table.add // LabelSkills + (new Label("Requiere " + requiredSkills + " puntos de Magia.", Skins.COMODORE_SKIN, "desc-no-background")) + .pad(0, 20, 0, 10).left().row(); + table.add // LabelMana + (new Label("Requiere " + requiredMana + " puntos de Maná.", Skins.COMODORE_SKIN, "desc-no-background")) + .pad(0, 20, 0, 10).left().row(); + table.add // LabelDaño TODO Llamar daño base desde el character + (new Label("Inflinge entre " + minhp + " (+DañoBase)" + "/" + maxhp + " (+DañoBase)", Skins.COMODORE_SKIN, "desc-no-background")) + .pad(0, 20, 0, 10).left().row(); + table.add // LabelDescripcion TODO hacer que el texto se ajuste a un tamaño fijo + (new Label(desc, + Skins.COMODORE_SKIN, + "desc-no-background" + )) + .pad(10, 20, 0, 10).row(); + return table; + } + + @Override + public void draw(Batch batch, float parentAlpha) { + super.draw(batch, parentAlpha); + if (spell == null) { + return; + } + drawSpell(batch); + spellViewExpanded.selected.filter( sp -> sp.equals(spell)).ifPresent( sp -> drawSelection(batch)); + } + + private void drawSelection(Batch batch) { + selection.draw(batch, getX(), getY(), SIZE, SIZE); + } + + private void drawSpell(Batch batch) { + Texture graphic = getSpellIcon(); + Color current = new Color(batch.getColor()); + batch.setColor(current.r, current.g, current.b, ICON_ALPHA); + batch.draw(graphic, getX() + 1, getY() + 1); + batch.setColor(current); + } + + private void onClick() { + spellViewExpanded.selected(spell); + } + + public boolean isOver() { + return clickListener != null && clickListener.isOver(); + } + + private Texture getSpellIcon() { + if (icon == null) { + icon = new Texture ( Gdx.files.local ( Resources.GAME_SPELL_ICONS_PATH + spell.getId ( ) + ".png" ) ); + } + return icon; + } +} diff --git a/client/src/game/ui/SpellView.java b/client/src/game/ui/SpellView.java index 1e490ff1..582d8188 100755 --- a/client/src/game/ui/SpellView.java +++ b/client/src/game/ui/SpellView.java @@ -61,7 +61,7 @@ private void changeCursor() { public void updateSpells() { WorldUtils.getWorld().ifPresent(world -> { SpellHandler spellHandler = world.getSystem(SpellHandler.class); - final Spell[] spells = spellHandler.getSpells(); + Spell[] spells = spellHandler.getSpells(); Spell[] spellsToShow = new Spell[MAX_SPELLS]; System.arraycopy(spells, base, spellsToShow, 0, Math.min(MAX_SPELLS, spells.length)); for (int i = 0; i < MAX_SPELLS; i++) { @@ -70,6 +70,10 @@ public void updateSpells() { }); } + public void addSpelltoSpellview(Spell spell, int slotPosition) { + slots.get(slotPosition).setSpell(spell); + } + private ImageButton createCastButton() { ImageButton staff = new ImageButton(Skins.COMODORE_SKIN, "staff"); staff.addListener(new ClickListener() { diff --git a/client/src/game/ui/SpellViewExpanded.java b/client/src/game/ui/SpellViewExpanded.java new file mode 100644 index 00000000..6630ce43 --- /dev/null +++ b/client/src/game/ui/SpellViewExpanded.java @@ -0,0 +1,133 @@ +package game.ui; + +import com.artemis.E; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import game.AOGame; +import game.handlers.AOAssetManager; +import game.handlers.SpellHandler; +import game.screens.GameScreen; +import game.utils.Colors; +import game.utils.Skins; +import game.utils.WorldUtils; +import shared.model.Spell; +import shared.util.Messages; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Stream; + +import static com.artemis.E.E; + +public class SpellViewExpanded extends Table { + + private static final int MAX_SPELLS = 25; + public Optional selected = Optional.empty(); + private Window spellTable; + private List slotsEC = new ArrayList<>(MAX_SPELLS); + private int base; + + private AOAssetManager assetManager; + + public SpellViewExpanded() { + super(Skins.COMODORE_SKIN); + assetManager = AOGame.getGlobalAssetManager(); + spellTable = new Window("", Skins.COMODORE_SKIN, "inventory"); + int columnsCounter = 1; + for (int i = 0; i < MAX_SPELLS; i++) { + SpellSlotEC slot = new SpellSlotEC(this, null); + slotsEC.add(slot); + + if (columnsCounter < 5) { + spellTable.add(slot).width(SpellSlotEC.SIZE).height(SpellSlotEC.SIZE); + } else { + spellTable.add(slot).width(SpellSlotEC.SIZE).height(SpellSlotEC.SIZE).row(); + columnsCounter = 0; + } + columnsCounter++; + } + add(spellTable); + spellTable.toFront(); + } + + + public void updateSpells() { + WorldUtils.getWorld().ifPresent(world -> { + SpellHandler spellHandler = world.getSystem(SpellHandler.class); + Spell[] spells = spellHandler.getSpells(); + Spell[] spellsToShow = new Spell[MAX_SPELLS]; + System.arraycopy(spells, 0, spellsToShow, 0, Math.min(MAX_SPELLS, spells.length)); + for (int i = 0; i < MAX_SPELLS; i++) { + slotsEC.get(i).setSpell(spellsToShow[i]); + } + }); + } + + public void newSpellAdd(int spellNum){ + AtomicBoolean present = new AtomicBoolean ( false ); + WorldUtils.getWorld().ifPresent(world -> { + SpellHandler spellHandler = world.getSystem ( SpellHandler.class ); + Spell[] spells = spellHandler.getSpells(); + Spell[] spellsToShow = new Spell[MAX_SPELLS]; + Optional< Spell > newSpell = spellHandler.getSpell ( spellNum ); + newSpell.ifPresent ( spell1 -> { + if(spells.length <= MAX_SPELLS ) { + for (Spell spell : spells) { + if (spell.equals(spell1)) { + present.set(true); + } + } + if (!present.get ( )) { + System.arraycopy(spells, 0, spellsToShow, 0, spells.length); + spellsToShow[spells.length] = spell1; + for (int i = 0; i < MAX_SPELLS; i++) { + slotsEC.get ( i ).setSpell ( spellsToShow[i] ); + } + world.getSystem ( GUI.class ).getConsole ( ).addInfo ( assetManager.getMessages( Messages.SPELLS_ADD, spell1.getName(), Integer.toString(spells.length + 1) ) ); + } else { + world.getSystem ( GUI.class ).getConsole ( ).addInfo ( assetManager.getMessages( Messages.SPELLS_ALREDY_KNOWN, spell1.getName() ) ); + } + } + else { + world.getSystem ( GUI.class ).getConsole ( ).addInfo ( assetManager.getMessages( Messages.SPELLS_FULL ) ); + } + }); + }); + E (GameScreen.getPlayer ()).getSpellBook ().addSpell ( spellNum ); + updateSpells (); + } + + void selected(Spell spell) { + selected = Optional.ofNullable(spell); + } + + + @Override + public void draw(Batch batch, float parentAlpha) { + int player = GameScreen.getPlayer(); + Color backup = batch.getColor(); + if (player >= 0) { + E e = E(player); + if (e != null && e.hasAttack()) { + batch.setColor(Colors.COMBAT); + } + } + super.draw(batch, parentAlpha); + batch.setColor(backup); + } + + public boolean isOver() { + return Stream.of(spellTable.getChildren().items) + .filter(SpellSlotEC.class::isInstance) + .map(SpellSlotEC.class::cast) + .anyMatch(SpellSlotEC::isOver); + } + + public Spell getSelected() { + return selected.orElse(null); + } +} diff --git a/client/src/game/ui/user/UserImage.java b/client/src/game/ui/user/UserImage.java index 74bf9781..ce9a8cc5 100644 --- a/client/src/game/ui/user/UserImage.java +++ b/client/src/game/ui/user/UserImage.java @@ -40,15 +40,15 @@ public void draw(Batch batch, float parentAlpha) { private void paintCircle(Batch batch, Level level) { float percent = getPercent(level); - float angle = (360 * percent); + float angle = 360 - (360 * percent % 360); radialSprite.setAngle(angle); - radialSprite.setScale(1.5f, 1.5f); - radialSprite.draw(batch, getX() + 15, getY() + 15, getWidth() - 16, getHeight() - 15); + radialSprite.setScale(0.8f, 0.8f); +// radialSprite.draw(batch, getX() + 15, getY() + 15, getWidth() - 15, getHeight() - 15); } private float getPercent(Level level) { - return (float) level.exp / (float) level.expToNextLevel; + return (float) level.exp / (float) level.expToNextLevel * 100f; } private void drawLevel(Batch batch, Level level) { diff --git a/components/src/entity/character/info/SpellBook.java b/components/src/entity/character/info/SpellBook.java index 08082ab5..2189c534 100644 --- a/components/src/entity/character/info/SpellBook.java +++ b/components/src/entity/character/info/SpellBook.java @@ -10,6 +10,7 @@ public class SpellBook extends Component implements Serializable { public final static int SIZE = 25; public Integer[] spells = new Integer[SIZE]; + private String msj = ""; public SpellBook() { } @@ -30,4 +31,33 @@ public void set(int i, Integer spellId) { spells[i] = spellId; } + + public void addSpell(int spellId){ + + boolean spellPresent = false; + System.out.println (spells.length); + for (Integer spell : spells) { + if (spell == spellId) { + spellPresent = true; + break; + } + } + if (!spellPresent){ + if (spells.length < SIZE){ + int spellLength = (spells.length + 1); + Integer[] spells1 = new Integer[spellLength]; + System.arraycopy(spells, 0, spells1, 0, spells.length); + spells1[spellLength-1] = spellId; + msj = "hechiso agregado"; + setSpells ( spells1 ); + } + } else { + msj = "ya conoces el hechiso o tu libro de echisos esta lleno"; + } + + } + + public String getMsj() { + return msj; + } } diff --git a/desktop/assets/data/ui/ao-skin-2/ao-skin.json b/desktop/assets/data/ui/ao-skin-2/ao-skin.json index ca9ed1f9..2396d9ea 100644 Binary files a/desktop/assets/data/ui/ao-skin-2/ao-skin.json and b/desktop/assets/data/ui/ao-skin-2/ao-skin.json differ diff --git a/desktop/assets/data/ui/ao-skin-2/ao-skin.png b/desktop/assets/data/ui/ao-skin-2/ao-skin.png index 4844f792..7824c67a 100644 Binary files a/desktop/assets/data/ui/ao-skin-2/ao-skin.png and b/desktop/assets/data/ui/ao-skin-2/ao-skin.png differ diff --git a/desktop/assets/data/ui/spells - copia/0.png b/desktop/assets/data/ui/spells - copia/0.png new file mode 100644 index 00000000..38ff9d4b Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/0.png differ diff --git a/desktop/assets/data/ui/spells - copia/1.png b/desktop/assets/data/ui/spells - copia/1.png new file mode 100644 index 00000000..1293bf64 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/1.png differ diff --git a/desktop/assets/data/ui/spells - copia/10.png b/desktop/assets/data/ui/spells - copia/10.png new file mode 100644 index 00000000..bfdc98f2 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/10.png differ diff --git a/desktop/assets/data/ui/spells - copia/11.png b/desktop/assets/data/ui/spells - copia/11.png new file mode 100644 index 00000000..383f38eb Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/11.png differ diff --git a/desktop/assets/data/ui/spells - copia/12.png b/desktop/assets/data/ui/spells - copia/12.png new file mode 100644 index 00000000..7e38e617 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/12.png differ diff --git a/desktop/assets/data/ui/spells - copia/13.png b/desktop/assets/data/ui/spells - copia/13.png new file mode 100644 index 00000000..8efb2fa2 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/13.png differ diff --git a/desktop/assets/data/ui/spells - copia/14.png b/desktop/assets/data/ui/spells - copia/14.png new file mode 100644 index 00000000..cbfbc3d9 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/14.png differ diff --git a/desktop/assets/data/ui/spells - copia/16.png b/desktop/assets/data/ui/spells - copia/16.png new file mode 100644 index 00000000..b4312dfb Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/16.png differ diff --git a/desktop/assets/data/ui/spells - copia/17.png b/desktop/assets/data/ui/spells - copia/17.png new file mode 100644 index 00000000..ebd601d3 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/17.png differ diff --git a/desktop/assets/data/ui/spells - copia/18 - copia.png b/desktop/assets/data/ui/spells - copia/18 - copia.png new file mode 100644 index 00000000..fbef0017 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/18 - copia.png differ diff --git a/desktop/assets/data/ui/spells - copia/19.png b/desktop/assets/data/ui/spells - copia/19.png new file mode 100644 index 00000000..68835954 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/19.png differ diff --git a/desktop/assets/data/ui/spells - copia/2.png b/desktop/assets/data/ui/spells - copia/2.png new file mode 100644 index 00000000..95bba64e Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/2.png differ diff --git a/desktop/assets/data/ui/spells - copia/20.png b/desktop/assets/data/ui/spells - copia/20.png new file mode 100644 index 00000000..78a6069d Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/20.png differ diff --git a/desktop/assets/data/ui/spells - copia/21.png b/desktop/assets/data/ui/spells - copia/21.png new file mode 100644 index 00000000..3f839e5c Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/21.png differ diff --git a/desktop/assets/data/ui/spells - copia/22.png b/desktop/assets/data/ui/spells - copia/22.png new file mode 100644 index 00000000..dceffcfc Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/22.png differ diff --git a/desktop/assets/data/ui/spells - copia/23.png b/desktop/assets/data/ui/spells - copia/23.png new file mode 100644 index 00000000..ba058b2b Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/23.png differ diff --git a/desktop/assets/data/ui/spells - copia/27.png b/desktop/assets/data/ui/spells - copia/27.png new file mode 100644 index 00000000..5fe1c8f7 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/27.png differ diff --git a/desktop/assets/data/ui/spells - copia/28.png b/desktop/assets/data/ui/spells - copia/28.png new file mode 100644 index 00000000..fc3d4300 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/28.png differ diff --git a/desktop/assets/data/ui/spells - copia/29.png b/desktop/assets/data/ui/spells - copia/29.png new file mode 100644 index 00000000..480ae470 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/29.png differ diff --git a/desktop/assets/data/ui/spells - copia/3.png b/desktop/assets/data/ui/spells - copia/3.png new file mode 100644 index 00000000..d1c920e5 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/3.png differ diff --git a/desktop/assets/data/ui/spells - copia/30.png b/desktop/assets/data/ui/spells - copia/30.png new file mode 100644 index 00000000..770a34bf Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/30.png differ diff --git a/desktop/assets/data/ui/spells - copia/32.png b/desktop/assets/data/ui/spells - copia/32.png new file mode 100644 index 00000000..7928a16a Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/32.png differ diff --git a/desktop/assets/data/ui/spells - copia/33.png b/desktop/assets/data/ui/spells - copia/33.png new file mode 100644 index 00000000..d8892301 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/33.png differ diff --git a/desktop/assets/data/ui/spells - copia/34.png b/desktop/assets/data/ui/spells - copia/34.png new file mode 100644 index 00000000..3f839e5c Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/34.png differ diff --git a/desktop/assets/data/ui/spells - copia/35.png b/desktop/assets/data/ui/spells - copia/35.png new file mode 100644 index 00000000..383f38eb Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/35.png differ diff --git a/desktop/assets/data/ui/spells - copia/38.png b/desktop/assets/data/ui/spells - copia/38.png new file mode 100644 index 00000000..fbef0017 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/38.png differ diff --git a/desktop/assets/data/ui/spells - copia/4.png b/desktop/assets/data/ui/spells - copia/4.png new file mode 100644 index 00000000..244c185e Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/4.png differ diff --git a/desktop/assets/data/ui/spells - copia/40.png b/desktop/assets/data/ui/spells - copia/40.png new file mode 100644 index 00000000..806192d8 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/40.png differ diff --git a/desktop/assets/data/ui/spells - copia/41.png b/desktop/assets/data/ui/spells - copia/41.png new file mode 100644 index 00000000..b9934a49 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/41.png differ diff --git a/desktop/assets/data/ui/spells - copia/42.png b/desktop/assets/data/ui/spells - copia/42.png new file mode 100644 index 00000000..4a3065a1 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/42.png differ diff --git a/desktop/assets/data/ui/spells - copia/43.png b/desktop/assets/data/ui/spells - copia/43.png new file mode 100644 index 00000000..4eeb4ee1 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/43.png differ diff --git a/desktop/assets/data/ui/spells - copia/5.png b/desktop/assets/data/ui/spells - copia/5.png new file mode 100644 index 00000000..25743fca Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/5.png differ diff --git a/desktop/assets/data/ui/spells - copia/6.png b/desktop/assets/data/ui/spells - copia/6.png new file mode 100644 index 00000000..89a084da Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/6.png differ diff --git a/desktop/assets/data/ui/spells - copia/7.png b/desktop/assets/data/ui/spells - copia/7.png new file mode 100644 index 00000000..a05fc671 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/7.png differ diff --git a/desktop/assets/data/ui/spells - copia/8.png b/desktop/assets/data/ui/spells - copia/8.png new file mode 100644 index 00000000..7bdf0d27 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/8.png differ diff --git a/desktop/assets/data/ui/spells - copia/9.png b/desktop/assets/data/ui/spells - copia/9.png new file mode 100644 index 00000000..7105d494 Binary files /dev/null and b/desktop/assets/data/ui/spells - copia/9.png differ diff --git a/desktop/assets/data/ui/spells/99.png b/desktop/assets/data/ui/spells - copia/99.png old mode 100755 new mode 100644 similarity index 100% rename from desktop/assets/data/ui/spells/99.png rename to desktop/assets/data/ui/spells - copia/99.png diff --git a/desktop/assets/data/ui/spells/0.png b/desktop/assets/data/ui/spells/0.png index 38ff9d4b..0f13a604 100755 Binary files a/desktop/assets/data/ui/spells/0.png and b/desktop/assets/data/ui/spells/0.png differ diff --git a/desktop/assets/data/ui/spells/1.png b/desktop/assets/data/ui/spells/1.png index 1293bf64..050b3ef1 100755 Binary files a/desktop/assets/data/ui/spells/1.png and b/desktop/assets/data/ui/spells/1.png differ diff --git a/desktop/assets/data/ui/spells/10.png b/desktop/assets/data/ui/spells/10.png index bfdc98f2..a99b5a9e 100755 Binary files a/desktop/assets/data/ui/spells/10.png and b/desktop/assets/data/ui/spells/10.png differ diff --git a/desktop/assets/data/ui/spells/11.png b/desktop/assets/data/ui/spells/11.png index 383f38eb..dea9cc22 100755 Binary files a/desktop/assets/data/ui/spells/11.png and b/desktop/assets/data/ui/spells/11.png differ diff --git a/desktop/assets/data/ui/spells/12.png b/desktop/assets/data/ui/spells/12.png index 7e38e617..cba56a3e 100755 Binary files a/desktop/assets/data/ui/spells/12.png and b/desktop/assets/data/ui/spells/12.png differ diff --git a/desktop/assets/data/ui/spells/13.png b/desktop/assets/data/ui/spells/13.png index 8efb2fa2..cba56a3e 100755 Binary files a/desktop/assets/data/ui/spells/13.png and b/desktop/assets/data/ui/spells/13.png differ diff --git a/desktop/assets/data/ui/spells/14.png b/desktop/assets/data/ui/spells/14.png index cbfbc3d9..67d4f6f2 100755 Binary files a/desktop/assets/data/ui/spells/14.png and b/desktop/assets/data/ui/spells/14.png differ diff --git a/desktop/assets/data/ui/spells/15.png b/desktop/assets/data/ui/spells/15.png new file mode 100644 index 00000000..0912e113 Binary files /dev/null and b/desktop/assets/data/ui/spells/15.png differ diff --git a/desktop/assets/data/ui/spells/16.png b/desktop/assets/data/ui/spells/16.png index b4312dfb..9d5068a6 100755 Binary files a/desktop/assets/data/ui/spells/16.png and b/desktop/assets/data/ui/spells/16.png differ diff --git a/desktop/assets/data/ui/spells/17.png b/desktop/assets/data/ui/spells/17.png index ebd601d3..af5df8c8 100755 Binary files a/desktop/assets/data/ui/spells/17.png and b/desktop/assets/data/ui/spells/17.png differ diff --git a/desktop/assets/data/ui/spells/18.png b/desktop/assets/data/ui/spells/18.png index fbef0017..8f20091b 100755 Binary files a/desktop/assets/data/ui/spells/18.png and b/desktop/assets/data/ui/spells/18.png differ diff --git a/desktop/assets/data/ui/spells/19.png b/desktop/assets/data/ui/spells/19.png index 68835954..d2539146 100755 Binary files a/desktop/assets/data/ui/spells/19.png and b/desktop/assets/data/ui/spells/19.png differ diff --git a/desktop/assets/data/ui/spells/2.png b/desktop/assets/data/ui/spells/2.png index 95bba64e..0afe2156 100755 Binary files a/desktop/assets/data/ui/spells/2.png and b/desktop/assets/data/ui/spells/2.png differ diff --git a/desktop/assets/data/ui/spells/20.png b/desktop/assets/data/ui/spells/20.png index 78a6069d..9591ed56 100755 Binary files a/desktop/assets/data/ui/spells/20.png and b/desktop/assets/data/ui/spells/20.png differ diff --git a/desktop/assets/data/ui/spells/21.png b/desktop/assets/data/ui/spells/21.png index 3f839e5c..8b4a6ba6 100755 Binary files a/desktop/assets/data/ui/spells/21.png and b/desktop/assets/data/ui/spells/21.png differ diff --git a/desktop/assets/data/ui/spells/23.png b/desktop/assets/data/ui/spells/23.png index ba058b2b..3ea21495 100755 Binary files a/desktop/assets/data/ui/spells/23.png and b/desktop/assets/data/ui/spells/23.png differ diff --git a/desktop/assets/data/ui/spells/24.png b/desktop/assets/data/ui/spells/24.png new file mode 100644 index 00000000..d47de54e Binary files /dev/null and b/desktop/assets/data/ui/spells/24.png differ diff --git a/desktop/assets/data/ui/spells/25.png b/desktop/assets/data/ui/spells/25.png new file mode 100644 index 00000000..fa082923 Binary files /dev/null and b/desktop/assets/data/ui/spells/25.png differ diff --git a/desktop/assets/data/ui/spells/26.png b/desktop/assets/data/ui/spells/26.png new file mode 100644 index 00000000..ea454305 Binary files /dev/null and b/desktop/assets/data/ui/spells/26.png differ diff --git a/desktop/assets/data/ui/spells/27.png b/desktop/assets/data/ui/spells/27.png index 5fe1c8f7..311470bf 100755 Binary files a/desktop/assets/data/ui/spells/27.png and b/desktop/assets/data/ui/spells/27.png differ diff --git a/desktop/assets/data/ui/spells/28.png b/desktop/assets/data/ui/spells/28.png index fc3d4300..24a7e976 100755 Binary files a/desktop/assets/data/ui/spells/28.png and b/desktop/assets/data/ui/spells/28.png differ diff --git a/desktop/assets/data/ui/spells/29.png b/desktop/assets/data/ui/spells/29.png index 480ae470..203f74a3 100755 Binary files a/desktop/assets/data/ui/spells/29.png and b/desktop/assets/data/ui/spells/29.png differ diff --git a/desktop/assets/data/ui/spells/3.png b/desktop/assets/data/ui/spells/3.png index d1c920e5..0d5bebb6 100755 Binary files a/desktop/assets/data/ui/spells/3.png and b/desktop/assets/data/ui/spells/3.png differ diff --git a/desktop/assets/data/ui/spells/30.png b/desktop/assets/data/ui/spells/30.png index 770a34bf..55706c4a 100755 Binary files a/desktop/assets/data/ui/spells/30.png and b/desktop/assets/data/ui/spells/30.png differ diff --git a/desktop/assets/data/ui/spells/31.png b/desktop/assets/data/ui/spells/31.png new file mode 100644 index 00000000..40e29f97 Binary files /dev/null and b/desktop/assets/data/ui/spells/31.png differ diff --git a/desktop/assets/data/ui/spells/32.png b/desktop/assets/data/ui/spells/32.png index 7928a16a..b9c3f998 100755 Binary files a/desktop/assets/data/ui/spells/32.png and b/desktop/assets/data/ui/spells/32.png differ diff --git a/desktop/assets/data/ui/spells/33.png b/desktop/assets/data/ui/spells/33.png index d8892301..9e5d421a 100755 Binary files a/desktop/assets/data/ui/spells/33.png and b/desktop/assets/data/ui/spells/33.png differ diff --git a/desktop/assets/data/ui/spells/34.png b/desktop/assets/data/ui/spells/34.png new file mode 100644 index 00000000..3f839e5c Binary files /dev/null and b/desktop/assets/data/ui/spells/34.png differ diff --git a/desktop/assets/data/ui/spells/35.png b/desktop/assets/data/ui/spells/35.png new file mode 100644 index 00000000..383f38eb Binary files /dev/null and b/desktop/assets/data/ui/spells/35.png differ diff --git a/desktop/assets/data/ui/spells/36.png b/desktop/assets/data/ui/spells/36.png new file mode 100644 index 00000000..ead5767d Binary files /dev/null and b/desktop/assets/data/ui/spells/36.png differ diff --git a/desktop/assets/data/ui/spells/362.png b/desktop/assets/data/ui/spells/362.png new file mode 100644 index 00000000..7928a16a Binary files /dev/null and b/desktop/assets/data/ui/spells/362.png differ diff --git a/desktop/assets/data/ui/spells/37.png b/desktop/assets/data/ui/spells/37.png new file mode 100644 index 00000000..383f38eb Binary files /dev/null and b/desktop/assets/data/ui/spells/37.png differ diff --git a/desktop/assets/data/ui/spells/38.png b/desktop/assets/data/ui/spells/38.png new file mode 100644 index 00000000..fbef0017 Binary files /dev/null and b/desktop/assets/data/ui/spells/38.png differ diff --git a/desktop/assets/data/ui/spells/39.png b/desktop/assets/data/ui/spells/39.png new file mode 100644 index 00000000..8aa1598a Binary files /dev/null and b/desktop/assets/data/ui/spells/39.png differ diff --git a/desktop/assets/data/ui/spells/4.png b/desktop/assets/data/ui/spells/4.png index 244c185e..8be8e9f7 100755 Binary files a/desktop/assets/data/ui/spells/4.png and b/desktop/assets/data/ui/spells/4.png differ diff --git a/desktop/assets/data/ui/spells/44.png b/desktop/assets/data/ui/spells/44.png new file mode 100644 index 00000000..383f38eb Binary files /dev/null and b/desktop/assets/data/ui/spells/44.png differ diff --git a/desktop/assets/data/ui/spells/45.png b/desktop/assets/data/ui/spells/45.png new file mode 100644 index 00000000..5fe1c8f7 Binary files /dev/null and b/desktop/assets/data/ui/spells/45.png differ diff --git a/desktop/assets/data/ui/spells/5.png b/desktop/assets/data/ui/spells/5.png index 25743fca..02bfbc27 100755 Binary files a/desktop/assets/data/ui/spells/5.png and b/desktop/assets/data/ui/spells/5.png differ diff --git a/desktop/assets/data/ui/spells/6.png b/desktop/assets/data/ui/spells/6.png index 89a084da..57b3862b 100755 Binary files a/desktop/assets/data/ui/spells/6.png and b/desktop/assets/data/ui/spells/6.png differ diff --git a/desktop/assets/data/ui/spells/7.png b/desktop/assets/data/ui/spells/7.png index a05fc671..a25bd09f 100755 Binary files a/desktop/assets/data/ui/spells/7.png and b/desktop/assets/data/ui/spells/7.png differ diff --git a/desktop/assets/data/ui/spells/8.png b/desktop/assets/data/ui/spells/8.png index 7bdf0d27..bec53554 100755 Binary files a/desktop/assets/data/ui/spells/8.png and b/desktop/assets/data/ui/spells/8.png differ diff --git a/desktop/assets/data/ui/spells/9.png b/desktop/assets/data/ui/spells/9.png index 7105d494..8aa1598a 100755 Binary files a/desktop/assets/data/ui/spells/9.png and b/desktop/assets/data/ui/spells/9.png differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 99c418e3..f521390f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip \ No newline at end of file diff --git a/server/src/server/systems/manager/ItemManager.java b/server/src/server/systems/manager/ItemManager.java index 8ccc5ebf..260d22b8 100644 --- a/server/src/server/systems/manager/ItemManager.java +++ b/server/src/server/systems/manager/ItemManager.java @@ -3,6 +3,7 @@ import com.artemis.Component; import com.artemis.E; import com.artemis.annotations.Wire; +import com.esotericsoftware.minlog.Log; import entity.character.attributes.Agility; import entity.character.attributes.Attribute; import entity.character.attributes.Strength; @@ -13,10 +14,7 @@ import shared.network.inventory.InventoryUpdate; import shared.network.notifications.EntityUpdate; import shared.network.notifications.EntityUpdate.EntityUpdateBuilder; -import shared.objects.types.Obj; -import shared.objects.types.ObjWithClasses; -import shared.objects.types.PotionObj; -import shared.objects.types.Type; +import shared.objects.types.*; import java.util.ArrayList; import java.util.List; @@ -57,7 +55,7 @@ public boolean isEquippable(Inventory.Item item) { public boolean isUsable(Inventory.Item item) { Optional object = objectManager.getObject(item.objId); - return object.map(obj -> obj.getType().equals(Type.POTION)).orElse(false); + return object.map(obj -> (obj.getType().equals(Type.POTION) || obj.getType ().equals (Type.SPELL )) ).orElse(false); } public void use(int player, Inventory.Item item) { @@ -101,6 +99,13 @@ public void use(int player, Inventory.Item item) { worldManager.sendEntityUpdate(player, update); // TODO remove from inventory } + if (obj.getType().equals(Type.SPELL)){ + SpellObj spellObj = (SpellObj) obj; + if (E (player).charHeroHeroId () != 0 ) { + E (player).spellBookAddSpell ( spellObj.getSpellIndex ( ) ); + } + Log.info( E ( player ).nameText () + " " +E ( player ).getSpellBook ( ).getMsj() ); + } }); } diff --git a/shared/resources/lang/messages_en_US.properties b/shared/resources/lang/messages_en_US.properties index f927ba04..79b906fb 100644 --- a/shared/resources/lang/messages_en_US.properties +++ b/shared/resources/lang/messages_en_US.properties @@ -44,4 +44,7 @@ READY=Ready FAILED_TO_CONNECT_TITLE=Network error FAILED_TO_CONNECT_DESCRIPTION=Failed to connect! :( MAX_ROOM_LIMIT_CREATION_TITLE=Room reach limit -MAX_ROOM_LIMIT_CREATION_DESCRIPTION=The limit of rooms has been reached \ No newline at end of file +MAX_ROOM_LIMIT_CREATION_DESCRIPTION=The limit of rooms has been reached +SPELLS_ADD=You've added the new spell {0} in Slot {1} of your spellbook. +SPELLS_ALREDY_KNOWN=You already know the spell {0}. +SPELLS_FULL=Your spellbook has reached its maximum capacity. \ No newline at end of file diff --git a/shared/resources/lang/messages_es_AR.properties b/shared/resources/lang/messages_es_AR.properties index 5b1f7c4e..45ce78c5 100644 --- a/shared/resources/lang/messages_es_AR.properties +++ b/shared/resources/lang/messages_es_AR.properties @@ -43,4 +43,7 @@ READY=Estoy listo FAILED_TO_CONNECT_TITLE=Error de red FAILED_TO_CONNECT_DESCRIPTION=Error al conectar! :( MAX_ROOM_LIMIT_CREATION_TITLE=Máximo de salas -MAX_ROOM_LIMIT_CREATION_DESCRIPTION=Se llegó al máximo de salas permitidas \ No newline at end of file +MAX_ROOM_LIMIT_CREATION_DESCRIPTION=Se llegó al máximo de salas permitidas +SPELLS_ADD=Agregaste el hechizo {0} en el slot {1} de tu libro de hechizos. +SPELLS_ALREDY_KNOWN=Ya conocés el hechizo {0}. +SPELLS_FULL=Tu libro de hechizos está lleno. \ No newline at end of file diff --git a/shared/resources/lang/messages_es_US.properties b/shared/resources/lang/messages_es_US.properties index 0fedd316..b15ceb56 100644 --- a/shared/resources/lang/messages_es_US.properties +++ b/shared/resources/lang/messages_es_US.properties @@ -43,4 +43,7 @@ READY=Estoy listo FAILED_TO_CONNECT_TITLE=Error de red FAILED_TO_CONNECT_DESCRIPTION=Error al conectar! :( MAX_ROOM_LIMIT_CREATION_TITLE=Máximo de salas -MAX_ROOM_LIMIT_CREATION_DESCRIPTION=Se ha llegado al máximo de salas permitidas \ No newline at end of file +MAX_ROOM_LIMIT_CREATION_DESCRIPTION=Se ha llegado al máximo de salas permitidas +SPELLS_ADD=Has agregado el hechizo {0} en el slot {1} de tu libro de hechizos. +SPELLS_ALREDY_KNOWN=Ya conoces el hechizo {0}. +SPELLS_FULL=Tu libro de hechizos está lleno. \ No newline at end of file diff --git a/shared/src/shared/util/Messages.java b/shared/src/shared/util/Messages.java index 8ef2ad03..072b0f62 100644 --- a/shared/src/shared/util/Messages.java +++ b/shared/src/shared/util/Messages.java @@ -63,5 +63,10 @@ public enum Messages { // LOBBY MESSAGES MAX_ROOM_LIMIT_CREATION_TITLE, - MAX_ROOM_LIMIT_CREATION_DESCRIPTION -} + MAX_ROOM_LIMIT_CREATION_DESCRIPTION, + + // SPELLS EXTENDED + SPELLS_ADD, + SPELLS_ALREDY_KNOWN, + SPELLS_FULL +} \ No newline at end of file