mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-15 13:54:51 +01:00
Implement heartlink invite
This commit is contained in:
@@ -25,6 +25,7 @@ import emu.nebula.game.quest.QuestCondType;
|
||||
import emu.nebula.net.NetMsgId;
|
||||
import emu.nebula.proto.Notify.Skin;
|
||||
import emu.nebula.proto.Notify.SkinChange;
|
||||
import emu.nebula.proto.Public.AffinityInfo;
|
||||
import emu.nebula.proto.Public.Char;
|
||||
import emu.nebula.proto.Public.CharGemPreset;
|
||||
import emu.nebula.proto.Public.CharGemSlot;
|
||||
@@ -861,6 +862,15 @@ public class GameCharacter implements GameDatabaseObject {
|
||||
return proto;
|
||||
}
|
||||
|
||||
public AffinityInfo getAffinityProto() {
|
||||
var proto = AffinityInfo.newInstance()
|
||||
.setCharId(this.getCharId())
|
||||
.setAffinityLevel(this.getAffinityLevel())
|
||||
.setAffinityExp(this.getAffinityExp());
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
// Database fix
|
||||
|
||||
@PreLoad
|
||||
|
||||
7
src/main/java/emu/nebula/game/dating/DatingEvent.java
Normal file
7
src/main/java/emu/nebula/game/dating/DatingEvent.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package emu.nebula.game.dating;
|
||||
|
||||
public interface DatingEvent {
|
||||
|
||||
public int getId();
|
||||
|
||||
}
|
||||
35
src/main/java/emu/nebula/game/dating/DatingEventType.java
Normal file
35
src/main/java/emu/nebula/game/dating/DatingEventType.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package emu.nebula.game.dating;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
|
||||
public enum DatingEventType {
|
||||
Start (1),
|
||||
End (2),
|
||||
Landmark (3),
|
||||
Regular (4),
|
||||
LimitedLandmark (5),
|
||||
BranchA (6),
|
||||
BranchB (7),
|
||||
BeforeBranch (8),
|
||||
AfterBranch (9);
|
||||
|
||||
@Getter
|
||||
private final int value;
|
||||
private final static Int2ObjectMap<DatingEventType> map = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
static {
|
||||
for (DatingEventType type : DatingEventType.values()) {
|
||||
map.put(type.getValue(), type);
|
||||
}
|
||||
}
|
||||
|
||||
private DatingEventType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static DatingEventType getByValue(int value) {
|
||||
return map.get(value);
|
||||
}
|
||||
}
|
||||
31
src/main/java/emu/nebula/game/dating/DatingGame.java
Normal file
31
src/main/java/emu/nebula/game/dating/DatingGame.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package emu.nebula.game.dating;
|
||||
|
||||
import emu.nebula.data.resources.DatingLandmarkDef;
|
||||
import emu.nebula.game.character.GameCharacter;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class DatingGame {
|
||||
private GameCharacter character;
|
||||
private DatingLandmarkDef landmark;
|
||||
|
||||
private int[] branchOptionsA;
|
||||
private int[] branchOptionsB;
|
||||
|
||||
public DatingGame(GameCharacter character, DatingLandmarkDef landmark) {
|
||||
this.character = character;
|
||||
this.landmark = landmark;
|
||||
this.branchOptionsA = new int[] {1, 2};
|
||||
this.branchOptionsB = new int[] {1, 2};
|
||||
}
|
||||
|
||||
public boolean selectDatingBranchA(int optionId) {
|
||||
// TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean selectDatingBranchB(int optionId) {
|
||||
// TODO
|
||||
return true;
|
||||
}
|
||||
}
|
||||
39
src/main/java/emu/nebula/game/dating/DatingManager.java
Normal file
39
src/main/java/emu/nebula/game/dating/DatingManager.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package emu.nebula.game.dating;
|
||||
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.game.character.GameCharacter;
|
||||
import emu.nebula.game.player.Player;
|
||||
import emu.nebula.game.player.PlayerManager;
|
||||
import emu.nebula.game.quest.QuestCondType;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class DatingManager extends PlayerManager {
|
||||
private DatingGame game;
|
||||
|
||||
public DatingManager(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
public DatingGame selectLandmark(GameCharacter character, int landmarkId) {
|
||||
// Get landmark data
|
||||
var data = GameData.getDatingLandmarkDataTable().get(landmarkId);
|
||||
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set landmark + character
|
||||
this.game = new DatingGame(character, data);
|
||||
|
||||
// Trigger quest
|
||||
this.getPlayer().triggerQuest(QuestCondType.CharactersDatingTotal, 1);
|
||||
|
||||
// Success
|
||||
return this.game;
|
||||
}
|
||||
|
||||
public void endDatingGame() {
|
||||
this.game = null;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import emu.nebula.game.account.Account;
|
||||
import emu.nebula.game.agent.AgentManager;
|
||||
import emu.nebula.game.battlepass.BattlePassManager;
|
||||
import emu.nebula.game.character.CharacterStorage;
|
||||
import emu.nebula.game.dating.DatingManager;
|
||||
import emu.nebula.game.formation.FormationManager;
|
||||
import emu.nebula.game.friends.FriendList;
|
||||
import emu.nebula.game.gacha.GachaManager;
|
||||
@@ -83,6 +84,7 @@ public class Player implements GameDatabaseObject {
|
||||
private final transient CharacterStorage characters;
|
||||
private final transient FriendList friendList;
|
||||
private final transient BattlePassManager battlePassManager;
|
||||
private final transient DatingManager datingManager;
|
||||
private final transient StarTowerManager starTowerManager;
|
||||
private final transient InstanceManager instanceManager;
|
||||
private final transient InfinityTowerManager infinityTowerManager;
|
||||
@@ -110,6 +112,7 @@ public class Player implements GameDatabaseObject {
|
||||
this.characters = new CharacterStorage(this);
|
||||
this.friendList = new FriendList(this);
|
||||
this.battlePassManager = new BattlePassManager(this);
|
||||
this.datingManager = new DatingManager(this);
|
||||
this.starTowerManager = new StarTowerManager(this);
|
||||
this.instanceManager = new InstanceManager(this);
|
||||
this.infinityTowerManager = new InfinityTowerManager(this);
|
||||
|
||||
Reference in New Issue
Block a user