IsHomeLocked update

This commit is contained in:
Michael Wain 2025-03-05 03:04:15 +03:00
parent 18cb96d21f
commit 27a7cbd2d3
6 changed files with 32 additions and 13 deletions

View File

@ -21,7 +21,6 @@ An unofficial server for semi-famous game Rolypolyland (Shararam). Remake by alt
- [Installation](#installation)
- [Build from source](#build)
- [Dependencies](#dependencies)
- [Mods](#mods)
- [Gallery](#gallery)
- [License](#license)

View File

@ -101,12 +101,14 @@ public class GameServer {
}
private void setPlayerAvatarPosition(long playerId, SetPlayerAvatarPosition message) {
players.get(playerId).setX((Double) message.getCoordinates().get("x").getValue());
players.get(playerId).setY((Double) message.getCoordinates().get("y").getValue());
if( message.getCoordinates() != null ) {
players.get(playerId).setX((Double) message.getCoordinates().get("x").getValue());
players.get(playerId).setY((Double) message.getCoordinates().get("y").getValue());
}
this.sendInPlayersLocation(playerId, CommandType.SetUserAvatarPosition,
new SetPlayerPosition(
playerId,
new Point((Double) message.getCoordinates().get("x").getValue(), (Double) message.getCoordinates().get("y").getValue()),
new Point(players.get(playerId).getX(), players.get(playerId).getY()),
message.getTweenerId().longValue()
)
);
@ -251,9 +253,19 @@ public class GameServer {
this.postcardService.removeById(postcardMessageId);
}
case BuyBatch -> buySomething(playerId, message.getArguments().get(0), message);
case LockHouse -> lockSomething(playerId, ((Number) message.getArguments().get(0).getValue()).intValue(), (Boolean) message.getArguments().get(1).getValue(), message);
}
}
private void lockSomething(long playerId, int what2Lock, Boolean state, UserMessage message) {
if( what2Lock == -2 ) {
this.users.pushUserProperty(playerId, PlayerProperties.IsClubLocked, state);
} else {
this.users.pushUserProperty(playerId, PlayerProperties.IsHomeLocked, state);
}
this.sendResult(playerId, message.getTransactionId(), state);
}
private void buySomething(long playerId, AMFObject obj, UserMessage message) {
List<AMFObject> array = (List<AMFObject>) obj.getValue();
array.forEach(i -> this.buyOne(playerId, i, message));

View File

@ -14,11 +14,19 @@ public enum AvatarInventoryType {
Smile(Collections.emptyList()),
House(Collections.singletonList(34)),
HouseFurniture(Collections.singletonList(20)),
Club(Collections.emptyList()), /////////////
ClubFacade(Collections.emptyList()), /////////////
ClubShow(Collections.emptyList()), /////////////
ClubFurniture(Collections.emptyList()), /////////
Achievments(Collections.emptyList()),
Club(Collections.singletonList(58)),
ClubFacade(Collections.singletonList(63)),
ClubShow(Collections.singletonList(78)),
ClubFurniture(Collections.singletonList(59)),
ClubInstruments(Collections.singletonList(105)),
ClubDigitalStuff(Collections.singletonList(68)),
ClubFloor(Collections.singletonList(61)),
ClubWallpaper(Collections.singletonList(62)),
ClubGames(Collections.singletonList(107)),
ClubFood(Collections.singletonList(67)),
ClubBeverages(Collections.singletonList(66)),
ClubDeserts(Collections.singletonList(65)),
Achievements(Collections.emptyList()),
BodyParts(Collections.emptyList());
private final List<Integer> goodTypes;

View File

@ -35,6 +35,7 @@ public enum UserCommandType {
CardMessage("_MC"),
MarkCardMessageAsRead("_MCR"),
DeleteCardMessage("_MCD"),
LockHouse("_LL"),
BuyBatch("_BGB"),
Unknown("");

View File

@ -14,7 +14,6 @@ import com.alterdekim.game.entity.*;
import com.alterdekim.game.repository.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;
import java.util.*;
@ -227,7 +226,7 @@ public class AvatarInventoryService {
}
public String getAchievementsByUserId(Long userId) {
return this.inventoryRepository.findItemsByUserIdAndType(userId, AvatarInventoryType.Achievments)
return this.inventoryRepository.findItemsByUserIdAndType(userId, AvatarInventoryType.Achievements)
.stream()
.map(a -> a.getGoodId().toString())
.collect(Collectors.joining(","));

View File

@ -257,7 +257,7 @@ public class UserService {
null,
getIsFriend(userId, plId),
getIntegerUserProperty(userId, PlayerProperties.Experience, 0),
getIntegerUserProperty(userId, PlayerProperties.Level, 1),
getIntegerUserProperty(userId, PlayerProperties.Level, 80),
getIntegerUserProperty(userId, PlayerProperties.MagicLevel, 1),
getIntegerUserProperty(userId, PlayerProperties.RaceLevel, 1),
inventoryService.getSelectedPhoneId(userId).intValue(),
@ -299,7 +299,7 @@ public class UserService {
Map<String, BodyAvatarItem> body = new HashMap<>();
List<BodyAvatarItem> i = inventoryService.getWholeAvatarByUserId(userId).stream().map(BodyAvatarItem::fromInterface).collect(Collectors.toList());
IntStream.range(0, i.size()).boxed().forEach(g -> body.put(String.valueOf(g+1), i.get(g)));
UserAvatar a = new UserAvatar(getIntegerUserProperty(userId, PlayerProperties.Level, 1), getUsernameById(userId).get(), p.getX(), p.getY(), p.getState(), body);
UserAvatar a = new UserAvatar(getIntegerUserProperty(userId, PlayerProperties.Level, 80), getUsernameById(userId).get(), p.getX(), p.getY(), p.getState(), body);
return new PlayerAvatar(String.valueOf(getRoleFlags(userId).getValue()), a);
}