mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-12 02:13:48 -04:00
Create Guild script for PDA, PDA Added to Frog, moved GuildService
Note that the PDA is only available on the frog if you have GM access right now.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/guild_registry')
|
||||
return
|
||||
@@ -0,0 +1,57 @@
|
||||
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:
|
||||
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):
|
||||
|
||||
# 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");
|
||||
suiSvc.openSUIWindow(wndGuildCreate)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def handleGuildCreateName(owner, window, eventType, returnList):
|
||||
|
||||
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");
|
||||
suiSvc.openSUIWindow(wndGuildInitials)
|
||||
return
|
||||
return
|
||||
|
||||
def doGuildCreate(owner, window, eventType, returnList):
|
||||
if eventType == 0:
|
||||
guild = NGECore().getInstance().guildService.createGuild(str(returnList.get(0)), str(owner.getAttachment('guildName')), owner)
|
||||
owner.setGuildId(guild.getId())
|
||||
return
|
||||
return
|
||||
@@ -86,7 +86,7 @@ import services.command.CombatCommand;
|
||||
import services.command.CommandService;
|
||||
import services.gcw.FactionService;
|
||||
import services.gcw.GCWService;
|
||||
import services.guild.GuildService;
|
||||
import services.GuildService;
|
||||
import services.LoginService;
|
||||
import services.map.MapService;
|
||||
import services.mission.MissionService;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package resources.guild;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
@@ -35,15 +36,17 @@ public class Guild extends Delta implements Serializable {
|
||||
private int id;
|
||||
private String abbreviation;
|
||||
private String name;
|
||||
private SWGObject leader;
|
||||
private List<SWGObject> members;
|
||||
private long leader;
|
||||
private String leaderName;
|
||||
private List<Long> members = new ArrayList<Long>();
|
||||
|
||||
public Guild(int id, String abbreviation, String name, SWGObject leader) {
|
||||
this.id = id;
|
||||
this.abbreviation = abbreviation;
|
||||
this.name = name;
|
||||
this.leader = leader;
|
||||
this.members.add(leader);
|
||||
this.leader = leader.getObjectID();
|
||||
this.leaderName = leader.getCustomName();
|
||||
this.members.add(leader.getObjectID());
|
||||
}
|
||||
|
||||
public Guild() {
|
||||
@@ -90,22 +93,34 @@ public class Guild extends Delta implements Serializable {
|
||||
return (Integer.toString(getId()) + ":" + getAbbreviation());
|
||||
}
|
||||
|
||||
public SWGObject getLeader() {
|
||||
public long getLeader() {
|
||||
synchronized(objectMutex) {
|
||||
return leader;
|
||||
}
|
||||
}
|
||||
|
||||
public void setLeader(SWGObject leader) {
|
||||
public void setLeader(long leader) {
|
||||
synchronized(objectMutex) {
|
||||
this.leader = leader;
|
||||
}
|
||||
}
|
||||
|
||||
public List<SWGObject> getMembers() {
|
||||
public List<Long> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
public String getLeaderName() {
|
||||
synchronized(objectMutex) {
|
||||
return leaderName;
|
||||
}
|
||||
}
|
||||
|
||||
public void setLeaderName(String leaderName) {
|
||||
synchronized(objectMutex) {
|
||||
this.leaderName = leaderName;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
synchronized(objectMutex) {
|
||||
IoBuffer buffer = createBuffer((getString().length() + 2));
|
||||
|
||||
@@ -88,10 +88,14 @@ public class DevService implements INetworkDispatch {
|
||||
suiOptions.put((long) 26, "Installations");
|
||||
suiOptions.put((long) 110, "Survey Devices");
|
||||
if(creature.getPlayerObject().getProfession().equals("bounty_hunter_1a")) suiOptions.put((long) 123, "Tracking Droids");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 121, "Sandbox City");
|
||||
if (creature.getClient().isGM()) {
|
||||
suiOptions.put((long) 120, "House Deeds");
|
||||
suiOptions.put((long) 125, "Crafting Tools");
|
||||
suiOptions.put((long) 130, "Vehicle Deeds");
|
||||
suiOptions.put((long) 121, "Sandbox City");
|
||||
suiOptions.put((long) 140, "Guild Registry Device (PDA)");
|
||||
}
|
||||
|
||||
break;
|
||||
case 3: // [Items] Weapons
|
||||
suiOptions.put((long) 30, "Jedi Weapons");
|
||||
@@ -1263,6 +1267,11 @@ public class DevService implements INetworkDispatch {
|
||||
inventory.add(swoopDeed);
|
||||
inventory.add(av21deed);
|
||||
return;
|
||||
|
||||
case 140:
|
||||
TangibleObject guildRegistry = (TangibleObject) core.objectService.createObject("object/tangible/furniture/technical/shared_guild_registry_initial.iff", planet);
|
||||
inventory.add(guildRegistry);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package services.guild;
|
||||
package services;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -55,15 +55,9 @@ public class GuildService implements INetworkDispatch {
|
||||
|
||||
if (leader == null)
|
||||
return null;
|
||||
|
||||
int id = 0;
|
||||
if (object.getGuildList().size() < 1) {
|
||||
id = 0;
|
||||
} else {
|
||||
id = ((object.getGuildList().get(object.getGuildList().size()).getId() + 1));
|
||||
}
|
||||
|
||||
Guild guild = new Guild(id, abbreviation, name, leader);
|
||||
int listSize = object.getGuildList().size();
|
||||
Guild guild = new Guild((listSize == 0 ? 1 : (object.getGuildList().get(listSize).getId()) + 1), abbreviation, name, leader);
|
||||
|
||||
object.getGuildList().add(guild);
|
||||
|
||||
Reference in New Issue
Block a user