mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-16 06:13:45 -04:00
Player Association Access added to datapad on creation, added guildId delta, changed getGuildList to return SWGSet<Guild>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/guild_access_device')
|
||||
return
|
||||
@@ -0,0 +1,30 @@
|
||||
from resources.common import RadialOptions
|
||||
from services.sui.SUIService import InputBoxType
|
||||
from java.util import Vector
|
||||
from main import NGECore
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
|
||||
#radials.clear()
|
||||
|
||||
if owner.getGuildId() != 0:
|
||||
guild = core.guildService.getGuildById(owner.getGuildId)
|
||||
|
||||
if guild is None:
|
||||
return
|
||||
|
||||
if guild.getLeader() == owner.getObjectID():
|
||||
radials.add(RadialOptions(0, RadialOptions.serverGuildGuildManagement, 3, '@guild:menu_guild_management'))
|
||||
radials.add(RadialOptions(0, RadialOptions.serverGuildMemberManagement, 3, '@guild:menu_member_management'))
|
||||
|
||||
#Guild Management
|
||||
radials.add(RadialOptions(3, RadialOptions.serverGuildDisband, 3, '@guild:menu_disband'))
|
||||
|
||||
#Member Management
|
||||
radials.add(RadialOptions(4, RadialOptions.serverGuildSponsor, 3, '@guild:menu_sponsor'))
|
||||
return
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
return
|
||||
@@ -12,39 +12,29 @@ def createRadial(core, owner, target, radials):
|
||||
radials.add(RadialOptions(0, RadialOptions.serverGuildCreate, 3, '@guild:menu_create'))
|
||||
return
|
||||
|
||||
else:
|
||||
radials.add(RadialOptions(0, RadialOptions.serverGuildGuildManagement, 3, '@guild:menu_guild_management'))
|
||||
radials.add(RadialOptions(0, RadialOptions.serverGuildMemberManagement, 3, '@guild:menu_member_management'))
|
||||
|
||||
#Guild Management
|
||||
|
||||
radials.add(RadialOptions(3, RadialOptions.serverGuildDisband, 3, '@guild:menu_disband'))
|
||||
|
||||
#Member Management
|
||||
radials.add(RadialOptions(4, RadialOptions.serverGuildSponsor, 3, '@guild:menu_sponsor'))
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
|
||||
suiSvc = NGECore().getInstance().suiService
|
||||
# Create Guild
|
||||
if option == 185 and target:
|
||||
wndGuildCreate = core.suiService.createInputBox(InputBoxType.INPUT_BOX_OK_CANCEL, '@guild:create_name_title', '@guild:create_name_prompt', owner, owner, 0, handleGuildCreateName)
|
||||
wndGuildCreate.setProperty("txtInput:MaxLength", "25");
|
||||
wndGuildCreate.setProperty("txtInput:MaxLength", "24");
|
||||
wndGuildCreate.setProperty("txtInput:NumericInteger", "false")
|
||||
suiSvc.openSUIWindow(wndGuildCreate)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def handleGuildCreateName(owner, window, eventType, returnList):
|
||||
|
||||
suiSvc = NGECore().getInstance().suiService
|
||||
if eventType == 0:
|
||||
guildName = str(returnList.get(0))
|
||||
if guildName is not None:
|
||||
owner.setAttachment('guildName', guildName)
|
||||
wndGuildInitials = NGECore().getInstance().suiService.createInputBox(InputBoxType.INPUT_BOX_OK, '@guild:create_abbrev_title', '@guild:create_abbrev_prompt', owner, owner, 0, doGuildCreate)
|
||||
wndGuildInitials.setProperty("txtInput:MaxLength", "5");
|
||||
wndGuildInitials.setProperty("txtInput:MaxLength", "4");
|
||||
wndGuildInitials.setProperty("txtInput:NumericInteger", "false")
|
||||
suiSvc.openSUIWindow(wndGuildInitials)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.apache.mina.core.buffer.IoBuffer;
|
||||
import engine.resources.objects.Delta;
|
||||
import engine.resources.objects.SWGObject;
|
||||
|
||||
public class Guild extends Delta implements Serializable {
|
||||
public class Guild extends Delta implements Serializable, Comparable<Guild> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int id;
|
||||
@@ -129,4 +129,9 @@ public class Guild extends Delta implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Guild guild) {
|
||||
return ((Integer) id).compareTo(guild.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -682,6 +682,16 @@ public class CreatureMessageBuilder extends TangibleMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildGuildIdDelta(int guildId) {
|
||||
IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(guildId);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x0F, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildGroupInviteDelta(long inviteSenderId, String inviteSenderName, long inviteCounter) {
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(18 + inviteSenderName.length(), false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
@@ -915,6 +915,10 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
synchronized(objectMutex) {
|
||||
this.guildId = guildId;
|
||||
}
|
||||
|
||||
IoBuffer guildIdDelta = messageBuilder.buildGuildIdDelta(guildId);
|
||||
|
||||
notifyObservers(guildIdDelta, true);
|
||||
}
|
||||
|
||||
public long getLookAtTarget() {
|
||||
|
||||
@@ -95,8 +95,8 @@ public class GuildObject extends UniverseObject implements Serializable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SWGList<Guild> getGuildList() {
|
||||
return (SWGList<Guild>) getBaseline(3).get("guildList");
|
||||
public SWGSet<Guild> getGuildList() {
|
||||
return (SWGSet<Guild>) getBaseline(3).get("guildList");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -60,6 +60,7 @@ import protocol.swg.ClientVerifyAndLockNameResponse;
|
||||
import protocol.swg.CreateCharacterSuccess;
|
||||
import protocol.swg.HeartBeatMessage;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.intangible.IntangibleObject;
|
||||
import resources.objects.mission.MissionObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
@@ -338,6 +339,9 @@ public class CharacterService implements INetworkDispatch {
|
||||
object._add(defaultWeapon);
|
||||
object.setWeaponId(defaultWeapon.getObjectID());
|
||||
|
||||
IntangibleObject pda = (IntangibleObject) core.objectService.createObject("object/intangible/data_item/shared_guild_stone.iff", object.getPlanet());
|
||||
datapad.add(pda);
|
||||
|
||||
createStarterClothing(object, sharedRaceTemplate, clientCreateCharacter.getStarterProfession());
|
||||
//core.scriptService.callScript("scripts/", "demo", "CreateStartingCharacter", core, object);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ package services;
|
||||
import java.util.Map;
|
||||
|
||||
import resources.guild.Guild;
|
||||
import resources.objects.SWGList;
|
||||
import resources.objects.SWGSet;
|
||||
import resources.objects.guild.GuildObject;
|
||||
import main.NGECore;
|
||||
import engine.resources.objects.SWGObject;
|
||||
@@ -57,7 +57,7 @@ public class GuildService implements INetworkDispatch {
|
||||
return null;
|
||||
|
||||
int listSize = object.getGuildList().size();
|
||||
Guild guild = new Guild((listSize == 0 ? 1 : (object.getGuildList().get(listSize).getId()) + 1), abbreviation, name, leader);
|
||||
Guild guild = new Guild((listSize == 0 ? 1 : listSize + 1), abbreviation, name, leader);
|
||||
|
||||
object.getGuildList().add(guild);
|
||||
|
||||
@@ -68,38 +68,20 @@ public class GuildService implements INetworkDispatch {
|
||||
return object;
|
||||
}
|
||||
|
||||
public SWGList<Guild> getGuildList() {
|
||||
public SWGSet<Guild> getGuildList() {
|
||||
return object.getGuildList();
|
||||
}
|
||||
|
||||
public Guild getGuildById(int id) {
|
||||
for (int i = 0; i < object.getGuildList().size(); i++) {
|
||||
if (object.getGuildList().get(i).getId() == id) {
|
||||
return object.getGuildList().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return object.getGuildList().stream().filter(g -> g.getId() == id).findFirst().get();
|
||||
}
|
||||
|
||||
public Guild getGuildByAbbreviation(String abbreviation) {
|
||||
for (int i = 0; i < object.getGuildList().size(); i++) {
|
||||
if (object.getGuildList().get(i).getAbbreviation().equals(abbreviation)) {
|
||||
return object.getGuildList().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return object.getGuildList().stream().filter(g -> g.getAbbreviation().equals(abbreviation)).findFirst().get();
|
||||
}
|
||||
|
||||
public Guild getGuildByName(String name) {
|
||||
for (int i = 0; i < object.getGuildList().size(); i++) {
|
||||
if (object.getGuildList().get(i).getName().equals(name)) {
|
||||
return object.getGuildList().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return object.getGuildList().stream().filter(g -> g.getName().equals(name)).findFirst().get();
|
||||
}
|
||||
|
||||
public boolean removeGuild(int id) {
|
||||
|
||||
Reference in New Issue
Block a user