Conflicts:
	src/resources/objects/intangible/IntangibleObject.java
This commit is contained in:
Treeku
2014-05-12 17:50:08 +01:00
8 changed files with 215 additions and 6 deletions
+145 -1
View File
@@ -1,4 +1,11 @@
import sys
from java.util import HashMap
from java.util import Vector
from services.sui.SUIService import ListBoxType
from services.sui.SUIService import InputBoxType
from main import NGECore
from java.lang import Long
from services.sui.SUIWindow import Trigger
def setup():
return
@@ -12,14 +19,151 @@ def run(core, actor, target, commandString):
building = actor.getGrandparent()
ghost = actor.getSlottedObject('ghost')
if not ghost or not cell or not building or not core.housingService.getPermissions(player, cell)
if not ghost or not cell or not building or not core.housingService.getPermissions(actor, cell):
return
if ghost.getAmountOfVendors() >= actor.getSkillModBase('manage_vendor'):
actor.sendSystemMessage('@player_structure:full_vendors', 0)
return
suiOptions = HashMap()
suiOptions.put(Long(1), '@player_structure:terminal')
suiOptions.put(Long(2), '@player_structure:droid')
# TODO add creatures
window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, '@player_structure:vendor_type_t', '@player_structure:vendor_type_d', suiOptions, actor, None, 5)
returnList = Vector()
returnList.add('List.lstList:SelectedRow')
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleFirstWindow)
core.suiService.openSUIWindow(window)
return
def handleFirstWindow(actor, window, eventType, returnList):
core = NGECore.getInstance()
index = int(returnList.get(0))
selected = window.getObjectIdByIndex(index)
hiring = actor.getSkillModBase('hiring')
if selected == 1:
suiOptions = HashMap()
if hiring >= 10:
suiOptions.put(Long(1), '@player_structure:terminal_bulky')
if hiring >= 30:
suiOptions.put(Long(2), '@player_structure:terminal_standard')
if hiring >= 50:
suiOptions.put(Long(3), '@player_structure:terminal_small')
if hiring >= 75:
suiOptions.put(Long(4), '@player_structure:terminal_fancy')
if hiring >= 90:
suiOptions.put(Long(5), '@player_structure:terminal_slim')
window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, '@player_structure:terminal_type_t', '@player_structure:terminal_type_d', suiOptions, actor, None, 5)
returnList = Vector()
returnList.add('List.lstList:SelectedRow')
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleTerminalWindow)
core.suiService.openSUIWindow(window)
if selected == 2:
suiOptions = HashMap()
if hiring >= 20:
suiOptions.put(Long(1), '@player_structure:droid_bartender')
if hiring >= 50:
suiOptions.put(Long(2), '@player_structure:droid_power')
if hiring >= 60:
suiOptions.put(Long(3), '@player_structure:droid_wed')
if hiring >= 90:
suiOptions.put(Long(4), '@player_structure:droid_surgical')
if hiring >= 100:
suiOptions.put(Long(5), '@player_structure:droid_protocol')
window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, '@player_structure:droid_type_t', '@player_structure:droid_type_d', suiOptions, actor, None, 5)
returnList = Vector()
returnList.add('List.lstList:SelectedRow')
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleDroidWindow)
core.suiService.openSUIWindow(window)
return
def handleTerminalWindow(actor, window, eventType, returnList):
core = NGECore.getInstance()
index = int(returnList.get(0))
selected = window.getObjectIdByIndex(index)
if selected == 1:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_terminal_bulky.iff')
elif selected == 2:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_terminal_standard.iff')
elif selected == 3:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_terminal_small.iff')
elif selected == 4:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_terminal_fancy.iff')
elif selected == 5:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_terminal_slim.iff')
createNameVendorWindow(core, actor)
return
def handleDroidWindow(actor, window, eventType, returnList):
core = NGECore.getInstance()
index = int(returnList.get(0))
selected = window.getObjectIdByIndex(index)
if selected == 1:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_droid_bartender.iff')
elif selected == 2:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_droid_power.iff')
elif selected == 3:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_droid_wed.iff')
elif selected == 4:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_droid_surgical.iff')
elif selected == 5:
actor.setAttachment('selectedVendorTemplate', 'object/tangible/vendor/shared_vendor_droid_protocol.iff')
createNameVendorWindow(core, actor)
return
def createNameVendorWindow(core, actor):
window = core.suiService.createInputBox(InputBoxType.INPUT_BOX_OK_CANCEL, '@player_structure:name_t', '@player_structure:name_d', actor, None, 5, handleVendorName)
core.suiService.openSUIWindow(window)
return
def handleVendorName(actor, window, eventType, returnList):
core = NGECore.getInstance()
name = returnList.get(0)
print name
inventory = actor.getSlottedObject('inventory')
ghost = actor.getSlottedObject('ghost')
if not core.characterService.checkName(name, actor.getClient()):
actor.sendSystemMessage('@player_structure:obscene', 0)
createNameVendorWindow(core, actor)
return
if not actor.getAttachment('selectedVendorTemplate') or not inventory or not ghost:
actor.sendSystemMessage('@player_structure:create_failed', 0)
return
if actor.getInventoryItemCount() >= 80:
actor.sendSystemMessage('@player_structure:inventory_full_generic', 0)
return
vendor = core.objectService.createObject(actor.getAttachment('selectedVendorTemplate'), actor.getPlanet())
if not vendor:
actor.sendSystemMessage('@player_structure:create_failed', 0)
return
actor.setAttachment('selectedVendorTemplate', None)
vendor.setAttachment('isVendor', True)
vendor.setAttachment('vendorOwner', actor.getObjectID())
vendor.setAttachment('initialized', False)
vendor.setAttachment('vendorSearchEnabled', False)
vendor.setCustomName('Vendor: ' + name)
ghost.addVendor(vendor.getObjectID())
inventory.add(vendor)
actor.sendSystemMessage('@player_structure:create_success', 0)
return
+3
View File
@@ -9,6 +9,9 @@ def run(core, actor, target, commandString):
container = actor.getContainer()
parsedMsg = commandString.split(' ', 2)
if tarObj.getAttachment('initialized') is not None and target.getAttachment('initialized') == True:
return
if core.housingService.getPermissions(actor, container): # i should probably relook into my permissions system... it kinda sucks
if parsedMsg[0] == "up":
core.simulationService.transform(tarObj, Point3D(0, float(parsedMsg[1]) * 0.01, 0))
+3
View File
@@ -10,6 +10,9 @@ def run(core, actor, target, commandString):
container = actor.getContainer()
parsedMsg = commandString.split(' ', 2)
if tarObj.getAttachment('initialized') is not None and target.getAttachment('initialized') == True:
return
if core.housingService.getPermissions(actor, container): # i should probably relook into my permissions system... it kinda sucks
if parsedMsg[0] == "pitch":
core.simulationService.transform(tarObj, float(parsedMsg[1]), Point3D(1, 0, 0)) # this is messed up ???
+39
View File
@@ -0,0 +1,39 @@
from resources.common import RadialOptions
import sys
def createRadial(core, owner, target, radials):
radials.clear()
radials.add(RadialOptions(0, 11, 1, ''))
radials.add(RadialOptions(0, 55, 0, ''))
radials.add(RadialOptions(2, 56, 1, ''))
radials.add(RadialOptions(2, 57, 1, ''))
radials.add(RadialOptions(2, 58, 1, ''))
radials.add(RadialOptions(2, 59, 1, ''))
radials.add(RadialOptions(0, 52, 0, ''))
radials.add(RadialOptions(3, 53, 1, ''))
radials.add(RadialOptions(3, 54, 1, ''))
if not owner.getPlayerObject().getOwnedVendors().contains(target.getObjectID())
return
radials.add(RadialOptions(0, 112, 3, '@player_structure:vendor_control'))
if target.getAttachment('initialized') == False:
radials.add(RadialOptions(1, 118, 3, '@player_structure:vendor_init'))
else:
# soe reuses option 118
radials.add(RadialOptions(4, 118, 3, '@player_structure:vendor_status'))
radials.add(RadialOptions(4, 217, 3, '@player_structure:give_maintenance'))
radials.add(RadialOptions(4, 115, 3, '@player_structure:take_maintenance'))
if owner.getSkillModBase('private_register_vendor') >= 1:
radials.add(RadialOptions(4, 116, 3, '@player_structure:register_vendor'))
radials.add(RadialOptions(4, 205, 3, '@player_structure:enable_vendor_search'))
radials.add(RadialOptions(4, 206, 3, '@player_structure:disable_vendor_search'))
radials.add(RadialOptions(4, 121, 3, '@player_structure:customize_vendor'))
radials.add(RadialOptions(4, 114, 3, '@player_structure:vendor_pack'))
radials.add(RadialOptions(4, 117, 3, '@player_structure:remove_vendor'))
return
def handleSelection(core, owner, target, option):
return
+12
View File
@@ -87,6 +87,18 @@ public class CharacterService implements INetworkDispatch {
}
}
public boolean checkName(String name, Client client) {
// TODO: check for dev names, profane names, iconic names etc
try {
if(checkForDuplicateName(name, client.getAccountId()) || !name.matches(allowedCharsRegex))
return false;
} catch (SQLException e) {
e.printStackTrace();
}
return true;
}
@Override
public void insertOpcodes(Map<Integer,INetworkRemoteEvent> swgOpcodes, Map<Integer,INetworkRemoteEvent> objControllerOpcodes) {
+2 -2
View File
@@ -157,7 +157,7 @@ public class EquipmentService implements INetworkDispatch {
return new Object[] { result, message };
}
synchronized public void equip(CreatureObject actor, SWGObject item)
public void equip(CreatureObject actor, SWGObject item)
{
String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff"));
String serverTemplate = template.replace(".iff", "");
@@ -174,7 +174,7 @@ public class EquipmentService implements INetworkDispatch {
}
}
synchronized public void unequip(CreatureObject actor, SWGObject item)
public void unequip(CreatureObject actor, SWGObject item)
{
String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff"));
String serverTemplate = template.replace(".iff", "");
+4 -2
View File
@@ -142,9 +142,11 @@ public class BazaarService implements INetworkDispatch {
SWGObject terminal = core.objectService.getObject(terminalId);
if(terminal == null)
return;
int permission = 2;
if(terminal.getAttachment("isVendor") != null && (Boolean) terminal.getAttachment("isVendor"))
permission = (long) terminal.getAttachment("vendorOwner") == player.getObjectID() ? 0 : 1;
Point3D pos = terminal.getWorldPosition();
session.write(new IsVendorOwnerResponseMessage(2, 0, terminalId, getVendorUID((TangibleObject) terminal)).serialize());
session.write(new IsVendorOwnerResponseMessage(permission, 0, terminalId, getVendorUID((TangibleObject) terminal)).serialize());
});
+7 -1
View File
@@ -133,6 +133,12 @@ public class SUIService implements INetworkDispatch {
//System.out.println("SUI target is NOT creatureobject " + target.getTemplate());
}
if(target.getAttachment("isVendor") != null && (Boolean) target.getAttachment("isVendor") && ((CreatureObject) owner).getPlayerObject().getOwnedVendors().contains(target.getObjectID())) {
core.scriptService.callScript("scripts/radial/", "terminal/vendor", "createRadial", core, owner, target, request.getRadialOptions());
sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount());
return;
}
if(target.getGrandparent() != null && target.getGrandparent().getAttachment("structureAdmins") != null)
{
if(core.housingService.getPermissions(owner, target.getContainer()) && !getRadialFilename(target).equals("structure/structure_management_terminal"))
@@ -318,7 +324,7 @@ public class SUIService implements INetworkDispatch {
window.clearDataSource("List.dataList");
cloneData.entrySet().forEach(e -> window.addListBoxMenuItem(e.getValue(), e.getKey()));
cloneData.entrySet().forEach(e -> window.addListBoxMenuItem(e.getValue(), (long) e.getKey()));
return window;