Menu functionality improved

Lootkit implemented
Loot price and further stats considered
This commit is contained in:
CharonInferar
2014-04-18 21:52:04 +02:00
parent 73a3c98660
commit 814ebe6cf3
51 changed files with 764 additions and 73 deletions
+280 -31
View File
@@ -13,7 +13,7 @@ coreRef = 0
junkDealerRef = 0
def startConversation(core, actor, npc):
core.lootService.prepInv(actor)
#core.lootService.prepInv(actor)
global coreRef
global junkDealerRef
global sellItemListRef
@@ -43,7 +43,7 @@ def startConversation(core, actor, npc):
options.add(option2)
options.add(option3)
if core.lootService.getBuyHistory(actor,npc)!=None:
if len(core.lootService.getBuyHistory(actor,npc))!= 0:
prose5 = ProsePackage('conversation/junk_dealer_generic', 's_43')
outOfBand5 = OutOfBand()
outOfBand5.addProsePackage(prose5)
@@ -54,10 +54,17 @@ def startConversation(core, actor, npc):
return
def handleFirstScreen(core, actor, npc, selection):
convSvc = core.conversationService
if selection == 0:
# sell items
prose = ProsePackage('conversation/junk_dealer_generic', 's_84a67771')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
sellItemListRef = core.lootService.getSellableInventoryItems(actor)
if len(sellItemListRef) == 0:
@@ -68,12 +75,9 @@ def handleFirstScreen(core, actor, npc, selection):
window = core.suiService.createSUIWindow('Script.listBox', actor, npc, 0)
window.setProperty('bg.caption.lblTitle:Text', '@loot_dealer:sell_title')
window.setProperty('Prompt.lblPrompt:Text', '@loot_dealer:sell_prompt')
for item in sellItemListRef:
window.addListBoxMenuItem(item.getCustomName(), 0);
actor.sendSystemMessage('ddf ' + item.getCustomName(), 1)
window.setProperty('btnOther:visible', 'True')
window.setProperty('btnCancel:visible', 'True')
@@ -106,7 +110,7 @@ def handleFirstScreen(core, actor, npc, selection):
nameString = '[*No Sell*]' + item.getCustomName()
window.addListBoxMenuItem(nameString, 0)
else:
nameString = '[*Sell*]' + item.getCustomName()
nameString = '[Sellable]' + item.getCustomName()
window.addListBoxMenuItem(nameString, 0)
window.setProperty('btnOther:visible', 'True')
@@ -125,10 +129,25 @@ def handleFirstScreen(core, actor, npc, selection):
window.addHandler(2, '',11, returnList, noSellWindowCallBack)
core.suiService.openSUIWindow(window);
return
if selection == 2:
lootKitScreen1(core, actor, npc)
if selection == 3:
# buy back
buyHistory = coreRef.lootService.getBuyHistory(actor,npc)
if len(buyHistory) == 0:
actor.sendSystemMessage('@loot_dealer:no_buy_back_items_found', 1)
startConversation(coreRef,actor,npc)
return
prose = ProsePackage('conversation/junk_dealer_generic', 's_44')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
window = core.suiService.createSUIWindow('Script.listBox', actor, npc, 0)
window.setProperty('bg.caption.lblTitle:Text', '@loot_dealer:buy_back_title')
window.setProperty('Prompt.lblPrompt:Text', '@loot_dealer:buy_back_prompt')
@@ -137,8 +156,13 @@ def handleFirstScreen(core, actor, npc, selection):
if buyHistory==None:
return
for item in buyHistory:
nameString = '[%s' % 100 + ']' + item.getCustomName() #%item.getJunkDealerPrice()
junkDealerPrice = item.getJunkDealerPrice()
if junkDealerPrice == 0:
junkDealerPrice = 20
nameString = '[%s' % junkDealerPrice + ']' + item.getCustomName() #%
window.addListBoxMenuItem(nameString, 0)
window.setProperty('btnOther:visible', 'True')
@@ -177,16 +201,13 @@ def handleResetScreen(core, actor, npc, selection):
return
def endConversation(core, actor, npc):
core.conversationService.sendStopConversation(actor, npc, 'conversation/junk_dealer_generic', 's_38')
core.conversationService.sendStopConversation(actor, npc, 'conversation/junk_dealer_generic', 's_4bd9d15e')
return
def sellWindowCallBack(owner, window, eventType, returnList):
if returnList.get(0) == 0:
owner.sendSystemMessage("huh?", 1)
#startConversation(coreRef,owner,junkDealerRef)
return
sellItemListRef = coreRef.lootService.getSellableInventoryItems(owner)
#sell
if eventType == 0:
@@ -204,33 +225,33 @@ def sellWindowCallBack(owner, window, eventType, returnList):
inventory = owner.getSlottedObject('inventory')
junkPrice = 20
owner.setCashCredits(owner.getCashCredits()+junkPrice);
junkDealerPrice = sellItem.getJunkDealerPrice()
if junkDealerPrice == 0:
junkDealerPrice = 20
owner.setCashCredits(owner.getCashCredits()+junkDealerPrice)
# add item to 10-item junk dealer history
coreRef.lootService.addToBuyHistory(owner,junkDealerRef,sellItem)
#You sell %TT for %DI credits.
owner.sendSystemMessage("sold "+sellItem.getCustomName(), 1)
#owner.sendSystemMessage(ProsePackage("@junk_dealer:prose_sold_junk", "TT", sellItem.getCustomName()), 0)
owner.sendSystemMessage(OutOfBand.ProsePackage("@junk_dealer:prose_sold_junk", "TT", sellItem.getCustomName(),junkDealerPrice), 0)
inventory.remove(sellItem)
coreRef.suiService.closeSUIWindow(owner,window.getWindowId());
coreRef.suiService.closeSUIWindow(owner,window.getWindowId())
handleFirstScreen(coreRef, owner, junkDealerRef, 0)
return
#cancel
if eventType == 1:
owner.sendSystemMessage("cancel ", 1)
#coreRef.suiService.closeSUIWindow(window,window.getWindowId());
#startConversation(coreRef,owner,junkDealerRef)
coreRef.suiService.closeSUIWindow(owner,window.getWindowId())
startConversation(coreRef,owner,junkDealerRef)
return
#examine
if eventType == 2:
owner.sendSystemMessage("examine ", 1)
#coreRef.suiService.closeSUIWindow(window,window.getWindowId());
#coreRef.suiService.closeSUIWindow(window,window.getWindowId())
#startConversation(coreRef,owner,junkDealerRef)
#owner.sendSystemMessage('Examine', 0)
return
@@ -252,7 +273,7 @@ def noSellWindowCallBack(owner, window, eventType, returnList):
else:
toggleItem.setNoSell(1)
#core.suiService.closeSUIWindow(window);
#core.suiService.closeSUIWindow(window)
handleFirstScreen(coreRef, owner, junkDealerRef, 1)
return
@@ -273,6 +294,8 @@ def noSellWindowCallBack(owner, window, eventType, returnList):
def buyBackWindowCallBack(owner, window, eventType, returnList):
convSvc = coreRef.conversationService
if returnList.get(0) == 0:
startConversation(coreRef,owner,junkDealerRef)
return
@@ -283,6 +306,8 @@ def buyBackWindowCallBack(owner, window, eventType, returnList):
buyHistory = coreRef.lootService.getBuyHistory(owner,junkDealerRef)
if len(buyHistory) == 0:
owner.sendSystemMessage('@loot_dealer:no_buy_back_items_found', 1)
startConversation(coreRef,owner,junkDealerRef)
return
buyBackItem = buyHistory.get(index)
@@ -290,12 +315,24 @@ def buyBackWindowCallBack(owner, window, eventType, returnList):
owner.sendSystemMessage('@loot_dealer:no_buy_back_items_found', 0)
startConversation(coreRef,owner,junkDealerRef)
return
if owner.getInventoryItemCount() >= 80:
prose = ProsePackage('conversation/junk_dealer_generic', 's_47')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(owner, junkDealerRef, outOfBand)
return
junkPrice = 20
if owner.getCashCredits()>=junkPrice and owner.getInventoryItemCount() < 80:
owner.setCashCredits(owner.getCashCredits()-junkPrice)
junkDealerPrice = buyBackItem.getJunkDealerPrice()
if junkDealerPrice == 0:
junkDealerPrice = 20
owner.setCashCredits(owner.getCashCredits()+junkDealerPrice)
if owner.getCashCredits()>=junkDealerPrice:
owner.setCashCredits(owner.getCashCredits()-junkDealerPrice)
inventory = owner.getSlottedObject('inventory')
inventory.add(buyBackItem)
owner.sendSystemMessage('You buy back ' + buyBackItem.getCustomName() + ' for %s' % junkDealerPrice + ' credits.', 0)
# remove from junk dealer history
coreRef.lootService.removeBoughtBackItemFromHistory(owner,junkDealerRef,buyBackItem)
else:
@@ -307,7 +344,7 @@ def buyBackWindowCallBack(owner, window, eventType, returnList):
#cancel
if eventType == 1:
owner.sendSystemMessage('Cancle', 0)
owner.sendSystemMessage('Cancel', 0)
sellItem = returnList.get(0)
startConversation(coreRef,owner,junkDealerRef)
return
@@ -319,5 +356,217 @@ def buyBackWindowCallBack(owner, window, eventType, returnList):
startConversation(coreRef,owner,junkDealerRef)
owner.sendSystemMessage('Examine', 0)
return
def handleLootScreenSelection1(core, actor, npc, selection):
convSvc = core.conversationService
if selection == 0:
lootKitScreen1(core, actor, npc)
return
def handleLootScreenSelection2(core, actor, npc, selection):
convSvc = core.conversationService
if selection == 0:
lootKitScreen2(core, actor, npc)
return
def handleLootScreenSelection3(core, actor, npc, selection):
convSvc = core.conversationService
if selection == 0:
lootKitScreen3(core, actor, npc)
return
def handleLootScreenSelection4(core, actor, npc, selection):
convSvc = core.conversationService
if selection == 0:
lootKitScreen4(core, actor, npc)
return
def handleLootScreenSelection5(core, actor, npc, selection):
convSvc = core.conversationService
if selection == 0:
lootKitScreen5a(core, actor, npc)
if selection == 1:
lootKitScreen5b(core, actor, npc)
return
def handleLootScreenSelection6(core, actor, npc, selection):
convSvc = core.conversationService
prose = ProsePackage('conversation/junk_dealer_generic', 's_14efaaa2')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
if selection == 0:
template = 'object/tangible/loot/collectible/kits/shared_orange_rug_kit.iff'
addLootKit(core, actor, npc,template)
if selection == 1:
template = 'object/tangible/loot/collectible/kits/shared_blue_rug_kit.iff'
addLootKit(core, actor, npc,template)
if selection == 2:
template = 'object/tangible/loot/collectible/kits/shared_gong_kit.iff'
addLootKit(core, actor, npc,template)
if selection == 3:
template = 'object/tangible/loot/collectible/kits/shared_light_table_kit.iff'
addLootKit(core, actor, npc,template)
if selection == 4:
template = 'object/tangible/loot/collectible/kits/shared_sculpture_kit.iff'
addLootKit(core, actor, npc,template)
return
def addLootKit(core, actor, npc,template):
kit = core.objectService.createObject(template, actor.getPlanet())
inventory = actor.getSlottedObject('inventory')
inventory.add(kit)
return
def lootKitScreen1(core, actor, npc):
convSvc = core.conversationService
prose = ProsePackage('conversation/junk_dealer_generic', 's_d9e6b751')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
prose2 = ProsePackage('conversation/junk_dealer_generic', 's_6d53d062')
outOfBand2 = OutOfBand()
outOfBand2.addProsePackage(prose2)
option1 = ConversationOption(outOfBand2, 0)
options = Vector()
options.add(option1)
convSvc.sendConversationOptions(actor, npc, options, handleLootScreenSelection2)
return
def lootKitScreen2(core, actor, npc):
convSvc = core.conversationService
prose = ProsePackage('conversation/junk_dealer_generic', 's_e29f48dc')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
prose2 = ProsePackage('conversation/junk_dealer_generic', 's_324b9b0f')
outOfBand2 = OutOfBand()
outOfBand2.addProsePackage(prose2)
option1 = ConversationOption(outOfBand2, 0)
options = Vector()
options.add(option1)
convSvc.sendConversationOptions(actor, npc, options, handleLootScreenSelection3)
return
def lootKitScreen3(core, actor, npc):
convSvc = core.conversationService
prose = ProsePackage('conversation/junk_dealer_generic', 's_12fe83a6')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
prose2 = ProsePackage('conversation/junk_dealer_generic', 's_e1a103e5')
outOfBand2 = OutOfBand()
outOfBand2.addProsePackage(prose2)
option1 = ConversationOption(outOfBand2, 0)
options = Vector()
options.add(option1)
convSvc.sendConversationOptions(actor, npc, options, handleLootScreenSelection4)
return
def lootKitScreen4(core, actor, npc):
convSvc = core.conversationService
prose = ProsePackage('conversation/junk_dealer_generic', 's_4d65752')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
prose2 = ProsePackage('conversation/junk_dealer_generic', 's_d347bee3')
outOfBand2 = OutOfBand()
outOfBand2.addProsePackage(prose2)
prose3 = ProsePackage('conversation/junk_dealer_generic', 's_b60b73f8')
outOfBand3 = OutOfBand()
outOfBand3.addProsePackage(prose3)
option1 = ConversationOption(outOfBand2, 0)
option2 = ConversationOption(outOfBand3, 0)
options = Vector()
options.add(option1)
options.add(option2)
convSvc.sendConversationOptions(actor, npc, options, handleLootScreenSelection5)
return
def lootKitScreen5a(core, actor, npc):
convSvc = core.conversationService
prose = ProsePackage('conversation/junk_dealer_generic', 's_3fc7eb45')
outOfBand = OutOfBand()
outOfBand.addProsePackage(prose)
convSvc.sendConversationMessage(actor, npc, outOfBand)
prose2 = ProsePackage('conversation/junk_dealer_generic', 's_ee977dee')
outOfBand2 = OutOfBand()
outOfBand2.addProsePackage(prose2)
prose3 = ProsePackage('conversation/junk_dealer_generic', 's_8f39769')
outOfBand3 = OutOfBand()
outOfBand3.addProsePackage(prose3)
prose4 = ProsePackage('conversation/junk_dealer_generic', 's_fe657cdd')
outOfBand4 = OutOfBand()
outOfBand4.addProsePackage(prose4)
prose5 = ProsePackage('conversation/junk_dealer_generic', 's_9ede4b84')
outOfBand5 = OutOfBand()
outOfBand5.addProsePackage(prose5)
prose6 = ProsePackage('conversation/junk_dealer_generic', 's_87c5851b')
outOfBand6 = OutOfBand()
outOfBand6.addProsePackage(prose6)
option1 = ConversationOption(outOfBand2, 0)
option2 = ConversationOption(outOfBand3, 0)
option3 = ConversationOption(outOfBand4, 0)
option4 = ConversationOption(outOfBand5, 0)
option5 = ConversationOption(outOfBand6, 0)
options = Vector()
options.add(option1)
options.add(option2)
options.add(option3)
options.add(option4)
options.add(option5)
convSvc.sendConversationOptions(actor, npc, options, handleLootScreenSelection6)
return
def lootKitScreen5b(core, actor, npc):
startConversation(core,actor,npc)
return
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Left Bicep'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Right Bicep'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Boots'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Bracer Left'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Bracer Right'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Chestplate'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Gloves'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Helmet'
def customItemStackCount():
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Composite Armor Leggings'
def customItemStackCount():
@@ -5,4 +5,4 @@ def itemTemplate():
def customItemName():
return ''
return 'Tusken Raider Bandolier'
@@ -5,4 +5,4 @@ def itemTemplate():
def customItemName():
return ''
return 'Tusken Raider Boots'
@@ -5,4 +5,4 @@ def itemTemplate():
def customItemName():
return ''
return 'Tusken Raider Dress'
@@ -5,4 +5,4 @@ def itemTemplate():
def customItemName():
return ''
return 'Tusken Raider Gloves'
@@ -5,4 +5,4 @@ def itemTemplate():
def customItemName():
return ''
return 'Tusken Raider Helmet'
@@ -2,3 +2,7 @@
def itemTemplate():
return ['object/tangible/loot/creature_loot/generic/shared_generic_antennae.iff']
def customItemName():
return 'Antenna'
@@ -2,3 +2,7 @@
def itemTemplate():
return ['object/tangible/loot/creature_loot/generic/shared_generic_eye.iff']
def customItemName():
return 'Eye'
@@ -2,3 +2,7 @@
def itemTemplate():
return ['object/tangible/loot/creature_loot/generic/shared_generic_heart.iff']
def customItemName():
return 'Heart'
@@ -2,3 +2,7 @@
def itemTemplate():
return ['object/tangible/loot/creature_loot/generic/shared_generic_stomach.iff']
def customItemName():
return 'Stomach'
@@ -2,3 +2,20 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_armor_repair_device_generic.iff']
def customItemName():
return 'Armor Repair Device'
def stackable():
return 1
def junkDealerPrice():
return 28
def junkType():
return 0
@@ -5,4 +5,16 @@ def itemTemplate():
def customItemName():
return 'Chassis Blueprint'
return 'Chassis Blueprint'
def stackable():
return 1
def junkDealerPrice():
return 21
def junkType():
return 0
+13 -1
View File
@@ -5,4 +5,16 @@ def itemTemplate():
def customItemName():
return 'Comlink'
return 'Comlink'
def stackable():
return 1
def junkDealerPrice():
return 15
def junkType():
return 0
@@ -6,4 +6,16 @@ def itemTemplate():
def customItemName():
return 'Damaged Datapad'
def stackable():
return 1
def junkDealerPrice():
return 8
def junkType():
return 0
+4
View File
@@ -2,3 +2,7 @@
def itemTemplate():
return ['/object/tangible/loot/npc_loot/shared_jewelry_ear_s02.iff']
def customItemName():
return 'Ear jewel'
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_firework_dud_s1.iff']
def customItemName():
return 'Explosive Dud'
def stackable():
return 1
def junkDealerPrice():
return 10
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/misc/shared_hyperdrive_part_s01.iff']
def customItemName():
return 'Hyperdrive Unit'
def stackable():
return 1
def junkDealerPrice():
return 34
def junkType():
return 0
+12
View File
@@ -6,3 +6,15 @@ def itemTemplate():
def customItemName():
return 'ID Chip'
def stackable():
return 1
def junkDealerPrice():
return 14
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_impulse_detector_01_generic.iff']
def customItemName():
return 'Impulse Detector'
def stackable():
return 1
def junkDealerPrice():
return 17
def junkType():
return 0
+16
View File
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_laser_trap_generic.iff']
def customItemName():
return 'Laser Trap'
def stackable():
return 1
def junkDealerPrice():
return 22
def junkType():
return 0
+13 -1
View File
@@ -5,4 +5,16 @@ def itemTemplate():
def customItemName():
return 'Launcher Tube'
return 'Launcher Tube'
def stackable():
return 1
def junkDealerPrice():
return 16
def junkType():
return 0
+16
View File
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_ledger_generic.iff']
def customItemName():
return 'Ledger'
def stackable():
return 1
def junkDealerPrice():
return 13
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_magseal_detector_generic.iff']
def customItemName():
return 'MagSeal Detector'
def stackable():
return 1
def junkDealerPrice():
return 15
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_medical_console_generic.iff']
def customItemName():
return 'Medical Console'
def stackable():
return 1
def junkDealerPrice():
return 24
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_medical_device_generic.iff']
def customItemName():
return 'Medical Device'
def stackable():
return 1
def junkDealerPrice():
return 17
def junkType():
return 0
+16
View File
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_small_motor_generic.iff']
def customItemName():
return 'Motor'
def stackable():
return 1
def junkDealerPrice():
return 13
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff']
def customItemName():
return 'Power Output Analyzer'
def stackable():
return 1
def junkDealerPrice():
return 21
def junkType():
return 0
+16
View File
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_red_wiring_generic.iff']
def customItemName():
return 'Red Wiring'
def stackable():
return 1
def junkDealerPrice():
return 12
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_shield_module_generic.iff']
def customItemName():
return 'Shield Module'
def stackable():
return 1
def junkDealerPrice():
return 20
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_software_module_generic.iff']
def customItemName():
return 'Software Module'
def stackable():
return 1
def junkDealerPrice():
return 12
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_survival_equipment_generic.iff']
def customItemName():
return 'Survival Gear'
def stackable():
return 1
def junkDealerPrice():
return 11
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_survey_pad_adv_generic.iff']
def customItemName():
return 'Underpowered Survey Pad'
def stackable():
return 1
def junkDealerPrice():
return 13
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_serum_vial_generic.iff']
def customItemName():
return 'Unidentified Serum Vial'
def stackable():
return 1
def junkDealerPrice():
return 14
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_notebook_generic.iff']
def customItemName():
return 'Used Notebook'
def stackable():
return 1
def junkDealerPrice():
return 12
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/generic/shared_battery_useable_generic.iff']
def customItemName():
return 'Weak Droid Battery'
def stackable():
return 1
def junkDealerPrice():
return 9
def junkType():
return 0
@@ -2,3 +2,19 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_worklight_generic.iff']
def customItemName():
return 'Generic Worklight'
def stackable():
return 1
def junkDealerPrice():
return 10
def junkType():
return 0
@@ -5,7 +5,7 @@ def itemTemplate():
def customItemName():
return ''
return 'Gaderiffi Baton'
def customItemStackCount():
+1 -1
View File
@@ -14,7 +14,7 @@ def addPlanetSpawns(core, planet):
junkdealer = stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3525), float(4), float(-4804), float(0.70), float(0.71))
junkdealer.setOptionsBitmask(264)
junkdealer.setCustomName('Junk Dealer')
junkdealer.setCustomName('a Junk Dealer')
junkdealer.setAttachment('radial_filename', 'conversation');
junkdealer.setAttachment('conversationFile','junk_dealer')
@@ -53,7 +53,7 @@ import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=10)
@Persistent(version=11)
public class TangibleObject extends SWGObject {
// TODO: Thread safety
@@ -89,6 +89,8 @@ public class TangibleObject extends SWGObject {
@NotPersistent
private boolean lootItem = false;
private boolean stackable = false;
private int stackCount = 1;
private boolean noSell = false;
private byte junkType = -1;
private int junkDealerPrice = 0;
@@ -504,6 +506,22 @@ public class TangibleObject extends SWGObject {
this.lootItem = lootItem;
}
public boolean isStackable() {
return stackable;
}
public void setStackable(boolean stackable) {
this.stackable = stackable;
}
public int getStackCount() {
return stackCount;
}
public void setStackCount(int stackCount) {
this.stackCount = stackCount;
}
public boolean isNoSell() {
return noSell;
}
+45 -22
View File
@@ -29,28 +29,20 @@ import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Vector;
import protocol.swg.PlayClientEffectObjectMessage;
import protocol.swg.PlayClientEffectObjectTransformMessage;
import resources.objects.creature.CreatureObject;
import resources.objects.group.GroupObject;
import resources.objects.loot.LootGroup;
import resources.objects.loot.LootRollSession;
import resources.objects.resource.ResourceContainerObject;
import resources.objects.tangible.TangibleObject;
import resources.objects.weapon.WeaponObject;
import main.NGECore;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.CrcStringTableVisitor;
import engine.resources.common.CRC;
import engine.resources.container.Traverser;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
@@ -92,7 +84,7 @@ public class LootService implements INetworkDispatch {
return;
SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory");
core.simulationService.openContainer(requester, lootedObjectInventory);
setLooted(lootedObject);
setLooted(requester,lootedObject);
}
}
@@ -250,6 +242,7 @@ public class LootService implements INetworkDispatch {
}
}
@SuppressWarnings("unused")
private void handleLootPoolItems(String itemName,LootRollSession lootRollSession){
List<String> subfolders = new ArrayList<String>(); // Consider all sub-folders
@@ -288,6 +281,9 @@ public class LootService implements INetworkDispatch {
int stackCount = 1;
int biolink = 0;
int requiredCL = 1;
int stackable = -1;
int junkDealerPrice = 0;
byte junkType = -1;
String requiredProfession = "";
String requiredFaction = "";
Vector<String> customizationAttributes = null;
@@ -335,7 +331,15 @@ public class LootService implements INetworkDispatch {
if(core.scriptService.getMethod(itemPath,"","requiredFaction")!=null)
requiredFaction = (String)core.scriptService.fetchString(itemPath,"requiredFaction");
if(core.scriptService.getMethod(itemPath,"","stackable")!=null)
stackable = (Integer)core.scriptService.fetchInteger(itemPath,"stackable");
if(core.scriptService.getMethod(itemPath,"","junkDealerPrice")!=null)
junkDealerPrice = (Integer)core.scriptService.fetchInteger(itemPath,"junkDealerPrice");
if(core.scriptService.getMethod(itemPath,"","junkType")!=null)
junkType = (byte)core.scriptService.fetchInteger(itemPath,"junkType");
System.out.println("itemTemplate " + itemTemplate);
TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet());
@@ -345,6 +349,21 @@ public class LootService implements INetworkDispatch {
if (customName!=null)
handleCustomDropName(droppedItem, customName);
if (stackable!=-1){
if(stackable==1)
droppedItem.setStackable(true);
else
droppedItem.setStackable(false);
}
if (junkDealerPrice!=0){
droppedItem.setJunkDealerPrice(junkDealerPrice);
}
if (junkType!=-1){
droppedItem.setJunkType(junkType);
}
if (itemStats!=null){
if (itemStats.size()%3!=0){
@@ -373,6 +392,7 @@ public class LootService implements INetworkDispatch {
droppedItem.setStringAttribute("required_faction", requiredFaction);
}
lootRollSession.addDroppedItem(droppedItem);
}
@@ -779,13 +799,14 @@ public class LootService implements INetworkDispatch {
return 42%42;
}
public void setLooted(TangibleObject lootedObject){
public void setLooted(TangibleObject lootedObject,TangibleObject requester){
lootedObject.setLooted(true);
float y = -5.0F;
float qz= 1.06535322E9F;
Point3D effectorPosition = new Point3D(0,y,0);
Quaternion effectorOrientation = new Quaternion(0,0,0,qz);
PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("",lootedObject.getObjectID(),"",effectorPosition,effectorOrientation);
//((CreatureObject) requester).getClient().getSession().write(lmsg.serialize());
}
@@ -798,12 +819,14 @@ public class LootService implements INetworkDispatch {
@Override
public void process(SWGObject obj) {
String itemTemplate = obj.getTemplate();
if (itemTemplate.contains("loot/")){
sellableItems.add(obj);
}
}
TangibleObject tano = (TangibleObject) obj;
if (tano.getCustomName()!=null){
if (itemTemplate.contains("loot/")){
sellableItems.add(obj);
}
}
}
});
System.err.println("sellableItems " + sellableItems.size());
return sellableItems;
}
@@ -839,14 +862,12 @@ public class LootService implements INetworkDispatch {
public boolean addToBuyHistory(CreatureObject actor, CreatureObject dealer, TangibleObject item){
LinkedHashMap<Long,TangibleObject[]> businessHistory = (LinkedHashMap<Long,TangibleObject[]> )dealer.getAttachment("BusinessHistory");
if (businessHistory==null){
System.out.println("businessHistory==null");
businessHistory = new LinkedHashMap<Long,TangibleObject[]>();
dealer.setAttachment("BusinessHistory",businessHistory);
}
System.out.println("abusinessHistory.size " + businessHistory.size());
TangibleObject[] actorsBuyHistory = businessHistory.get(actor.getObjectID());
if (actorsBuyHistory==null){
System.out.println("actorsBuyHistory==null");
actorsBuyHistory = new TangibleObject[10];
actorsBuyHistory[0] = item;
} else {
@@ -868,10 +889,11 @@ public class LootService implements INetworkDispatch {
}
businessHistory.put(actor.getObjectID(),actorsBuyHistory);
dealer.setAttachment("BusinessHistory",businessHistory);
printArrayElements(actorsBuyHistory);
//printArrayElements(actorsBuyHistory);
return true;
}
@SuppressWarnings("unchecked")
public boolean removeBoughtBackItemFromHistory(CreatureObject actor, CreatureObject dealer, TangibleObject item){
if (item==null)
return false; // Player has hit the button without selecting an item
@@ -895,7 +917,7 @@ public class LootService implements INetworkDispatch {
if (index==-1)
return false;
// SHift everything to the right of the found index to the left
// Shift everything to the right of the found index to the left
for (int i = index; i < 9; i++) {
actorsBuyHistory[i] = actorsBuyHistory[i+1]; // 0 1 2 3 4 5 6 7 8 9
}
@@ -904,12 +926,13 @@ public class LootService implements INetworkDispatch {
businessHistory.put(actor.getObjectID(),actorsBuyHistory);
dealer.setAttachment("BusinessHistory",businessHistory);
printArrayElements(actorsBuyHistory);
//printArrayElements(actorsBuyHistory);
return true;
}
// util method
@SuppressWarnings("unused")
private void printArrayElements(TangibleObject[] array){
System.out.print("Array [");
for (int i=0;i<array.length;i++){