FANDOM


Created by Taz.

Using "RC_Core.rcm"
; testingrc1 1.26
; Date/Time: 10:50:35 PM on 5/16/2009
; By Tazco on NADDAZ
;COAL MINING
 
 Function Main()
 	Player = Actor()
 	Target = ContextActor()
 	Mininglvl% = Attribute(Player, "Mining")
 	TargetHealth% = Attribute(Target, "Health")
 	miningpicklvl% = ItemAttribute(ActorWeapon(Player), "Mining")
 	Miningchance% = Attribute(Player, "Mining") + miningpicklvl + Rand(75, 200)
 	Miningmiss% = Rand(50, 205)
 
 
 If (miningpicklvl >= 1)
 
 	If (Mininglvl >= 10) ; set to level 5 
 	AnimateActor(Player, "Mining", .5, 2)  ;Play mining anitmation.
 			Doevents(200) ;so sound dont play mid swing
    		If (TargetHealth >= 1)
	          	RandMiningSound% = Rand(1, 2)
                If (RandMiningSound = 1)
                    PlaySound(Player, 29, 1)
                Else    
                    PlaySound(Player, 55, 1)
                Endif
         	CurrSpeed% = Attribute(Player, "Speed") ;set player speed back to normal
            AddActorEffect(Player, "Mining", "Speed", - CurrSpeed, 2, 126)

			

	   		DoEvents(1500)

		  If (Miningchance > Miningmiss)
          
             PlaySound(Player, 54, 1)
            Doevents(200) ;so sound dont play mid swing
            AnimateActor(Player, "Mining", .5, 2)  ;Play mining anitmation.
			
			DoEvents(1200)
			GiveItem(Player, "Coal Ore", 1)
			OutPut(Player, "You collected 1 Coal Ore", 134, 124, 54)
		    Oretaken% = Attribute(Target, "Health") - 1	
			SetAttribute(Target, "Health", Oretaken)
			BaseMiningXp = 15
            ThreadExecute("In-game Achievements", "MManiacMain", Player, 0) ;send to Mining Maniac Achievement
			
			If (Mininglvl > 15)
			Extraore% = Rand(1, 855)
             	
 				If (Extraore = 32)
                     AnimateActor(Player, "Mining", .5, 2)  ;Play mining anitmation.
					GiveItem(Player, "Emerald", 1)
					OutPut(Player, "You collected a Emerald!!", 134, 124, 54)
					Oretaken = Attribute(Target, "Health") - 1
					ExtraOreXp% = 25
					
                    
			 	Elseif (Extraore = 48)
                    AnimateActor(Player, "Mining", .5, 2)  ;Play mining anitmation.
					GiveItem(Player, "Ruby", 1)
					OutPut(Player, "You collected a Ruby!!", 134, 124, 54)
					Oretaken = Attribute(Target, "Health") - 1
                    ExtraOreXp% = 50               					
				EndIf
               
 			EndIf	
             
 				;extra gem chance
                 ;---------------------
                 GemChance% = Rand(1, 500)
                  PlaySound(Player, 29, 1)
                If (GemChance = 55)
                    AnimateActor(Player, "Mining", .5, 2)  ;Play mining anitmation.
                    GiveItem(Player, "Diamond", 1)
                    OutPut(player, "You hvae recived a diamond", 134, 124, 54)
                    Oretaken = Attribute(Target, "Health") - 1
                    GemXp% = 75
                 	
                 EndIf
                ;------------------------
                
                
				If (TargetHealth) <= 0
					OutPut(Player, "You Have extracted all the ore from this rock", 255, 145, 34)
					SetAttribute(Target, "Health", 0)
					
			    EndIf
 			
            
             Else ;mining did not miss give ore
                        PlaySound(Player, 54, 1)
            Doevents(200) ;so sound dont play mid swing
                    AnimateActor(Player, "Mining", .5, 2)  ;Play mining anitmation.
                OutPut(Player, "You were unable to mine the rock", 155, 12, 64)
     			
      		EndIf	;end miss chance	
		
		EndIf ;end ore amount check

	Else
    
 	Output(Player, "You need a mining level of atleast 10, to mine this rock.", 155, 12, 64)
 
 	
 	EndIf ;end level to ming coal check
 
 
 Else
 OutPut(Player, "You need a pick axe equiped, to mine this rock.", 155, 12, 64)
 
 
 EndIf
 
 ;--------------------------------------------------------------------------------------------------------------------	

  ;get melee xp, add new xp and ccheck if player has a melee level              
        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
        ;extra skills for easy adding later.
        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")


MiningxpToGive% = Attribute(Player, "Mining") + Rand(5, 6) * 2 + MiningXp + BaseMiningXp + ExtraOreXp + GemXp
	
            ;Send to levelup if Mining level should be given.

         
             
              If (MiningxpToGive >= Mininglvl * 750) ;if player has amount of xp need to level send them to level up
                 
                ThreadExecute("LevelUp", "Main", Player, Target, 6)	;parameter for Mining = 6
                  MiningxpToGive% = 0 ;Set xp to 0
              EndIf
              
               
               
               
      SkillXPToStore$ = MeleeXp + "|" + RangingXp + "|" + MagicXp + "|" + AlchemyXp + "|" +  CraftingXp + "|" + HerbingXp + "|" + MiningxpToGive + "|" + PrayerXp + "|" + SmeltingXp + "|" + WoodCuttingXp + "|" + DodgeXp + "|" + DexXp + "|" + NewSkillXp1 + "|" + NewSkillXp2 + "|" + NewSkillXp3 + "|" + NewSkillXp4 + "|" + NewSkillXp5 + "|" + NewSkillXp6
  
      SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount
;--------------------------------------------------------------------------------------------------------------------



Return
End Function