All pastes #993857 Raw Edit

Something

public text v1 · immutable
#993857 ·published 2008-04-22 22:20 UTC
rendered paste body
;make a big list of enhancements as global variables :P
		(setq GlobalEnhancementArray '((0x0101 0x0102 0x0102 0x0103 0x0101 0x0102 0x0102 0x0103 0x0309 0x0329 0x0101 0x0102 0x0102 0x0103 0x0103 0x0104 0x0b00 0x0c00) (0x0101 0x0102 0x0102 0x0103 0x0102 0x0103 0x0103 0x0104 0x0104 0x0105 0x0101 0x0102 0x0102 0x0103 0x0104 0x0824 0x0842 0xf03) (0x0101 0x0102 0x0102 0x0103 0x0101 0x0101 0x0102 0x0102 0x0103 0x0104 0x0105 0x0102 0x0103 0x0103 0x0104 0x0104 0x0105 0x0101 0x0102 0x0102 0x0103 0x0f03 0x1002) (0)))

(setq intCategoryToIndex (lambda (theCategory)
	(block (arrayIndex)
		
		(dbgOutput "theCategory is " theCategory)
						
		(switch
			; Armor enhancement
			(eq theCategory 0x0002)
				(setq arrayIndex 0)
							
			; Shield enhancement
			(eq theCategory 0x0080)
				(setq arrayIndex 1)
							
			; Weapon enhancement
			(eq theCategory 0x0004)
				(setq arrayIndex 2)
			
			(setq arrayIndex 3)						
		)
		;return the array index
		arrayIndex	
	)))
		
		
(setq intRandomEnhanceItems (lambda (percentEnhanced tempItem)
	(block (rollEnhanced)
		
		
		;setq the necessary percent roll
		(setq rollEnhanced (random 1 100))
		(dbgOutput "rollEnhanced is " rollEnhanced)
		
		(if (leq percentEnhanced rollEnhanced)
			(setq tempItem (itmSetEnhanced tempItem (random (item GlobalEnhancementArray (intCategoryToIndex (itmGetCategory tempItem))))))			
		)
		
)))