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 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 handlePropose(owner, window, eventType, returnList): core = NGECore.getInstance() if owner is None: return if eventType == 0: proposer = core.objectService.getObjectByCustomName(owner.getAttachment("proposer")) if proposer is None: return core.playerService.performUnity(owner, proposer) return if eventType == 1: proposer = core.objectService.getObjectByCustomName(owner.getAttachment("proposer")) proposer.sendSystemMessage('@unity:declined', 0) for SWGObject in proposer.getEquipmentList(): if SWGObject.getAttachment("unity") is not None: SWGObject.setAttachment("unity", None) break owner.setAttachment("proposer", None) return return
def handlePropose(owner, window, eventType, returnList): core = NGECore.getInstance() if owner is None: return if eventType == 0: proposer = core.objectService.getObjectByCustomName( owner.getAttachment("proposer")) if proposer is None: return core.playerService.performUnity(owner, proposer) return if eventType == 1: proposer = core.objectService.getObjectByCustomName( owner.getAttachment("proposer")) proposer.sendSystemMessage('@unity:declined', 0) for SWGObject in proposer.getEquipmentList(): if SWGObject.getAttachment("unity") is not None: SWGObject.setAttachment("unity", None) break owner.setAttachment("proposer", None) return return
def bioLinkProcess(owner, window, eventType, returnList): objectID = owner.getAttachment('BioLinkItemCandidate') linkedobject = NGECore.getInstance().objectService.getObject(objectID) owner.sendSystemMessage('@base_player:item_bio_linked', 1) newRadial = linkedobject.getAttachment('Post_BL_radial_filename') linkedobject.setAttachment('radial_filename', newRadial) linkedobject.setStringAttribute('bio_link', owner.getCustomName()) return
def bioLinkProcess(owner, window, eventType, returnList): objectID = owner.getAttachment("BioLinkItemCandidate") linkedobject = NGECore.getInstance().objectService.getObject(objectID) owner.sendSystemMessage("@base_player:item_bio_linked", 1) newRadial = linkedobject.getAttachment("Post_BL_radial_filename") linkedobject.setAttachment("radial_filename", newRadial) linkedobject.setStringAttribute("bio_link", owner.getCustomName()) return
def handleSelection(core, owner, target, option): if option == 69 and target: player = core.objectService.getObject(owner.getTargetId()) tGhost = player.getSlottedObject('ghost') suiSvc = core.suiService if tGhost.getPosition().getDistance2D(owner.getWorldPosition()) < 50: owner.sendSystemMessage('@unity:out_of_range', 0) return if tGhost.getSpouseName() is not None: owner.sendSystemMessage('@unity:target_married', 0) return if player.getAttachment("proposer") is not None: owner.sendSystemMessage('@unity:target_proposed', 0) return else: owner.sendSystemMessage('You propose unity to ' + player.getCustomName() + '.', 0) targetWindow = suiSvc.createMessageBox(3, '@unity:accept_title', owner.getCustomName() + ' is proposing unity to you. Do you wish to accept?', tGhost.getContainer(), owner, 15) returnList = Vector() targetWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handlePropose) targetWindow.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handlePropose) player.setAttachment("proposer", owner.getCustomName()) suiSvc.openSUIWindow(targetWindow) target.setAttachment("unity", True) core.equipmentService.equip(owner, target) core.commandService.callCommand(owner, 'kneel', None, '') return return if option == 70: married = owner.getSlottedObject('ghost').getSpouseName() myGhost = owner.getSlottedObject('ghost') otherPlayer = NGECore.getInstance().objectService.getObjectByCustomName(married) if otherPlayer is None: return ghost = otherPlayer.getSlottedObject('ghost') if ghost is None: return owner.sendSystemMessage('Your union with ' + married + ' has ended.', 0) otherPlayer.sendSystemMessage('Your union with ' + owner.getCustomName() + ' has ended.', 0) myGhost.setSpouseName(None) ghost.setSpouseName(None) target.setAttachment("unity", None) #TODO: Divorce offline players return return
def handleBankTip(owner, window, eventType, returnList): core = NGECore.getInstance() chatSvc = core.chatService actorGlobal = core.objectService.getObject(actorID) targetGlobal = core.objectService.getObject(targetID) actorFunds = actorGlobal.getBankCredits() totalLost = int(tipAmountBank) + bankSurcharge if eventType == 0: if int(totalLost) > actorFunds: actorGlobal.sendSystemMessage('You do not have ' + str(totalLost) + ' credits (surcharge included) to tip the desired amount to ' + targetGlobal.getCustomName() + '.', 0) return if int(tipAmount) > 0 and int(actorFunds) >= int(totalLost): date = Date() targetName = targetGlobal.getCustomName() targetMail = Mail() targetMail.setMailId(chatSvc.generateMailId()) targetMail.setTimeStamp((int) (date.getTime() / 1000)) targetMail.setRecieverId(targetID) targetMail.setStatus(Mail.NEW) targetMail.setMessage(tipAmount + ' credits from ' + actorGlobal.getCustomName() + ' have been successfully delivered from escrow to your bank account') targetMail.setSubject('@base_player:wire_mail_subject') targetMail.setSenderName('bank') actorMail = Mail() actorMail.setMailId(chatSvc.generateMailId()) actorMail.setRecieverId(actorID) actorMail.setStatus(Mail.NEW) actorMail.setTimeStamp((int) (date.getTime() / 1000)) actorMail.setMessage('An amount of ' + tipAmount + ' credits have been transfered from your bank to escrow. It will be delivered to ' + targetGlobal.getCustomName() + ' as soon as possible.') actorMail.setSubject('@base_player:wire_mail_subject') actorMail.setSenderName('bank') targetGlobal.setBankCredits(int(tipAmount) + int(targetGlobal.getBankCredits())) actorGlobal.setBankCredits(int(actorFunds) - int(totalLost)) actorGlobal.sendSystemMessage('You have successfully sent ' + tipAmount + ' bank credits to ' + targetGlobal.getCustomName(), 0) targetGlobal.sendSystemMessage('You have successfully received ' + tipAmount + ' bank credits from ' + actorGlobal.getCustomName(), 0) chatSvc.storePersistentMessage(actorMail) chatSvc.storePersistentMessage(targetMail) chatSvc.sendPersistentMessageHeader(actorGlobal.getClient(), actorMail) chatSvc.sendPersistentMessageHeader(targetGlobal.getClient(), targetMail) return else: actorGlobal.sendSystemMessage('You lack the bank funds to wire ' + tipAmount + ' bank funds to ' + targetGlobal.getCustomName() + '.', 0) return 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 handleBankTip(core, owner, eventType, returnList): bankSurcharge = int(math.ceil(0.05 * float(transferTotal))) core = NGECore.getInstance() chatSvc = core.chatService actorGlobal = tipFrom targetGlobal = tipTo actorFunds = actorGlobal.getBankCredits() totalLost = int(transferTotal) + bankSurcharge if eventType == 0: if int(totalLost) > actorFunds: actorGlobal.sendSystemMessage('You do not have ' + str(totalLost) + ' credits (surcharge included) to tip the desired amount to ' + targetGlobal.getCustomName() + '.', 0) return if int(transferTotal) > 0 and int(actorFunds) >= int(totalLost): date = Date() targetName = targetGlobal.getCustomName() targetMail = Mail() targetMail.setMailId(chatSvc.generateMailId()) targetMail.setTimeStamp((int) (date.getTime() / 1000)) targetMail.setRecieverId(targetGlobal.getObjectId()) targetMail.setStatus(Mail.NEW) targetMail.setMessage(`transferTotal` + ' credits from ' + actorGlobal.getCustomName() + ' have been successfully delivered from escrow to your bank account') targetMail.setSubject('@base_player:wire_mail_subject') targetMail.setSenderName('bank') actorMail = Mail() actorMail.setMailId(chatSvc.generateMailId()) actorMail.setRecieverId(actorGlobal.getObjectId()) actorMail.setStatus(Mail.NEW) actorMail.setTimeStamp((int) (date.getTime() / 1000)) actorMail.setMessage('An amount of ' + `transferTotal` + ' credits have been transfered from your bank to escrow. It will be delivered to ' + targetGlobal.getCustomName() + ' as soon as possible.') actorMail.setSubject('@base_player:wire_mail_subject') actorMail.setSenderName('bank') targetGlobal.addBankCredits(int(transferTotal)) actorGlobal.deductBankCredits(int(totalLost)) actorGlobal.sendSystemMessage('You have successfully sent ' + `transferTotal` + ' bank credits to ' + targetGlobal.getCustomName(), 0) targetGlobal.sendSystemMessage('You have successfully received ' + `transferTotal` + ' bank credits from ' + actorGlobal.getCustomName(), 0) chatSvc.storePersistentMessage(actorMail) chatSvc.storePersistentMessage(targetMail) chatSvc.sendPersistentMessageHeader(actorGlobal.getClient(), actorMail) chatSvc.sendPersistentMessageHeader(targetGlobal.getClient(), targetMail) return else: actorGlobal.sendSystemMessage('You lack the bank funds to wire ' + `transferTotal` + ' bank funds to ' + targetGlobal.getCustomName() + '.', 0) return 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 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('onMap', True) vendor.setAttachment('maintenanceAmount', 0) vendor.setAttachment('vendorOwner', Long(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
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('onMap', True) vendor.setAttachment('maintenanceAmount', 0) vendor.setAttachment('vendorOwner', Long(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
def handleSelection(core, owner, target, option): if option == 69 and target: player = core.objectService.getObject(owner.getTargetId()) tGhost = player.getSlottedObject('ghost') suiSvc = core.suiService if tGhost.getPosition().getDistance2D(owner.getWorldPosition()) < 50: owner.sendSystemMessage('@unity:out_of_range', 0) return if tGhost.getSpouseName() is not None: owner.sendSystemMessage('@unity:target_married', 0) return if player.getAttachment("proposer") is not None: owner.sendSystemMessage('@unity:target_proposed', 0) return else: owner.sendSystemMessage( 'You propose unity to ' + player.getCustomName() + '.', 0) targetWindow = suiSvc.createMessageBox( 3, '@unity:accept_title', owner.getCustomName() + ' is proposing unity to you. Do you wish to accept?', tGhost.getContainer(), owner, 15) returnList = Vector() targetWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handlePropose) targetWindow.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handlePropose) player.setAttachment("proposer", owner.getCustomName()) suiSvc.openSUIWindow(targetWindow) target.setAttachment("unity", True) core.equipmentService.equip(owner, target) core.commandService.callCommand(owner, 'kneel', None, '') return return if option == 70: married = owner.getSlottedObject('ghost').getSpouseName() myGhost = owner.getSlottedObject('ghost') otherPlayer = NGECore.getInstance( ).objectService.getObjectByCustomName(married) if otherPlayer is None: return ghost = otherPlayer.getSlottedObject('ghost') if ghost is None: return owner.sendSystemMessage('Your union with ' + married + ' has ended.', 0) otherPlayer.sendSystemMessage( 'Your union with ' + owner.getCustomName() + ' has ended.', 0) myGhost.setSpouseName(None) ghost.setSpouseName(None) target.setAttachment("unity", None) #TODO: Divorce offline players return return