init
This commit is contained in:
		| @@ -0,0 +1,4 @@ | ||||
| --被他人击杀   杀人者指针 损失经验 | ||||
| defaultHandlerActorBeKilled = function (pActor,pKiller,nExploit) | ||||
|    | ||||
| end | ||||
| @@ -0,0 +1,5 @@ | ||||
| --改名事件 | ||||
| defaultHandleChangeNameOp = function (pActor, oldName, newName) | ||||
|      | ||||
|      | ||||
| end | ||||
| @@ -0,0 +1,4 @@ | ||||
| --消费元宝事件 消耗元宝数量 | ||||
| defaultHandleActorConsumeGameGold = function (pActor, nConsumeCount) | ||||
|    | ||||
| end | ||||
							
								
								
									
										70
									
								
								LogicServer/data/functions/ActorEvent/ActorDeadHandler.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								LogicServer/data/functions/ActorEvent/ActorDeadHandler.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| local defReliveConfId = StaticFubens[0].reliveConfId or 1 | ||||
| local defReliveConf = ReliveConfig[defReliveConfId] or ReliveConfig[1] | ||||
|  | ||||
| --人物死亡事件 | ||||
| defaultHandlerActorDead = function (pActor) | ||||
| 	local pFuben = Actor.getFubenPrt(pActor) | ||||
| 	--Actor.addState(pActor, esStateDeath) | ||||
| 	print("死亡") | ||||
| 	Actor.updateActorEntityProp(pActor) | ||||
|  | ||||
| 	-- 静态场景 | ||||
| 	if Fuben.isFuben(pFuben) == false then | ||||
| 		if Actor.getReliveTimeOut(pActor) == 0 then | ||||
|  | ||||
| 			--复活特权 | ||||
| 			local nCurReviveDuration = Actor.getIntProperty2(pActor, PROP_ACTOR_CURREVIVEDURATION); | ||||
|  | ||||
| 			if defReliveConf then | ||||
|  | ||||
| 				--复活特权 | ||||
| 				if nCurReviveDuration ~= 0 then | ||||
| 					Actor.setReliveTimeOut(pActor, (defReliveConf.VipRevive or 5)) | ||||
| 				else | ||||
| 					Actor.setReliveTimeOut(pActor, (defReliveConf.expire or 10)) | ||||
| 				end | ||||
|  | ||||
| 				local npack = DataPack.allocPacket(pActor, enDefaultEntitySystemID, sActorReliveInfo) | ||||
| 				if npack then | ||||
| 					DataPack.writeByte(npack, defReliveConfId) | ||||
| 					DataPack.writeByte(npack, -1) | ||||
| 					local count = (defReliveConf.selectInfo and #defReliveConf.selectInfo) or 0 | ||||
| 					DataPack.writeByte(npack, count) | ||||
| 					local actorData = FubenDispatcher.GetActorData(pActor,0) | ||||
| 					if actorData.relive == nil then | ||||
| 						actorData.relive = {} | ||||
| 					end | ||||
| 					if count > 0 then | ||||
| 						for i=1,count do | ||||
| 							if actorData.relive[i] == nil then | ||||
| 								actorData.relive[i] = defReliveConf.selectInfo[i].limit or -1 | ||||
| 							end | ||||
| 							DataPack.writeByte(npack, actorData.relive[i]) | ||||
| 						end | ||||
| 					end | ||||
|  | ||||
| 					-- 添加击杀者名字 | ||||
| 					local h_killer = Actor.getKillHandle(pActor) | ||||
| 					local pKiller = Actor.getEntity(h_killer) | ||||
| 					local name = "" | ||||
| 					if pKiller then | ||||
| 						name = Actor.getName(pKiller) | ||||
| 					end | ||||
| 					DataPack.writeString( npack, name ) | ||||
|         			DataPack.flush(npack) | ||||
| 				end | ||||
| 			else | ||||
| 				--复活特权 | ||||
| 				if nCurReviveDuration ~= 0 then | ||||
| 					Actor.setReliveTimeOut(pActor, 5) | ||||
| 				else | ||||
| 					Actor.setReliveTimeOut(pActor, 10) | ||||
| 				end | ||||
| 				 | ||||
| 			end | ||||
| 		end | ||||
| 	-- 副本中 | ||||
| 	else | ||||
| 		FubenDispatcher.OnActorDeath(pActor, pFuben) | ||||
| 	end | ||||
| end | ||||
| @@ -0,0 +1,39 @@ | ||||
| -- 人物活动时间进入泡点地图 | ||||
| defaultHandleEnterpaodianmap = function(pActor,args) | ||||
|              | ||||
| print("[ActorEtr_Exitpaodianmap],args: "..args) | ||||
|  | ||||
|     for k, v in pairs(ActivitiesConf) do | ||||
|         if v.ActivityType == 5 then | ||||
|             local atvId = v.Id | ||||
|             if Activity5Config[atvId].sceneId and args== Activity5Config[atvId].sceneId then  | ||||
|                 local cacheData = ActivityDispatcher.GetCacheData(atvId) | ||||
|                 if cacheData.actors == nil then | ||||
|                      cacheData.actors = {} | ||||
|                 end | ||||
|                 local actorId = Actor.getIntProperty( pActor, PROP_ENTITY_ID ) | ||||
|                 cacheData.actors[actorId] = actorId | ||||
|                 break | ||||
|             end | ||||
|         end  | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
| --人物退出泡点地图 | ||||
| defaultHandleExitpaodianmap = function(pActor,args) | ||||
|     for k, v in pairs(ActivitiesConf) do | ||||
|         if v.ActivityType == 5 then | ||||
|             local atvId = v.Id | ||||
|             if Activity5Config[atvId].sceneId and args== Activity5Config[atvId].sceneId then  | ||||
|                 local cacheData = ActivityDispatcher.GetCacheData(atvId) | ||||
|                 if cacheData.actors == nil then | ||||
|                      cacheData.actors = {} | ||||
|                 end | ||||
|                 local actorId = Actor.getIntProperty( pActor, PROP_ENTITY_ID ) | ||||
|                 cacheData.actors[actorId] = nil | ||||
|                 break | ||||
|             end | ||||
|         end  | ||||
|     end | ||||
| end | ||||
| @@ -0,0 +1,5 @@ | ||||
| --人物转生事件 | ||||
| defaultHandlerActorCirclel = function ( pActor,nCircle ) | ||||
| 	 | ||||
| 	local nLevel = Actor.getIntProperty(pActor, PROP_CREATURE_LEVEL) | ||||
| end | ||||
							
								
								
									
										31
									
								
								LogicServer/data/functions/ActorEvent/ActorEvents.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								LogicServer/data/functions/ActorEvent/ActorEvents.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| --#include "ActorBeKilledHandler.txt" once          --角色被杀 | ||||
| --#include "ActorChangeNameHandle.txt" once         --角色改名 | ||||
| --#include "ActorConsumeGameGoldHandler.txt" once   --角色使用元宝 | ||||
| --#include "ActorLoginHandler.txt" once             --角色登录 | ||||
| --#include "ActorLevelUpHandler.txt" once	        --角色升级 | ||||
| --#include "ActorEventCircleHandler.txt" once	    --角色转生 | ||||
| --#include "ActorDeadHandler.txt" once              --角色死亡 | ||||
| --#include "ActorReliveHandler.txt" once            --角色复活超时 | ||||
| --#include "ActorLeaveTeamHandler.txt" once         --角色离队 | ||||
| --#include "ActorLogoutHandler.txt" once            --角色登出 | ||||
| --#include "ActorNewDayHandler.txt" once            --角色跨天 | ||||
| --#include "ActorWithDrawGameGoldHandler.txt" once  --角色提取元宝(相当于充值) | ||||
| --#include "BuffRemovedHandler.txt" once            --角色移除BUFF | ||||
| --#include "FuBenHandler.txt" once                  --角色副本操作 | ||||
|  | ||||
|  | ||||
| ActorEventDispatcher.Reg(aeLevel,            defaultHandlerActorLevelUp,         "ActorLevelUpHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeUserLogin,        defaultHandlerPlayerLogin,          "ActorLoginHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeUserLogout,       defaultHandlerPlayerLogout,         "ActorLogoutHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeOnActorDeath,     defaultHandlerActorDead,            "ActorDeadHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeReliveTimeOut,    defaultHandlerActorReliveTimeOut,   "ActorReliveHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeNewDayArrive,     defaultHandleActorNewDay,           "ActorNewDayHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeOnActorBeKilled,  defaultHandlerActorBeKilled,        "ActorBeKilledHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeWithDrawYuanBao,  defaultHandleActorWithDrawGameGold, "ActorWithDrawGameGoldHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeConsumeYb,        defaultHandleActorConsumeGameGold,  "ActorConsumeGameGoldHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeOnEnterFuben,	 defaultHandlerEnterFuben,           "FuBenHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeOnExitFuben,	     defaultHandlerExitFuben,            "FuBenHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeBuffRemoved,      defaultHandlerBuffRemoved,          "BuffRemovedHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeLeaveTeam,        defaultHandlerLeaveTeam,            "ActorLeaveTeamHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeCircle,           defaultHandlerActorCirclel,         "ActorEventCircleHandler.txt") | ||||
| ActorEventDispatcher.Reg(aeChangeName,       defaultHandleChangeNameOp,          "ActorChangeNameHandle.txt") | ||||
| @@ -0,0 +1,4 @@ | ||||
| --人物离队事件,参数一个 当前人物当前等级  | ||||
| defaultHandlerLeaveTeam = function ( pActor ) | ||||
|  | ||||
| end | ||||
							
								
								
									
										111
									
								
								LogicServer/data/functions/ActorEvent/ActorLevelUpHandler.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								LogicServer/data/functions/ActorEvent/ActorLevelUpHandler.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | ||||
| --人物升级事件 当前人物当前等级 | ||||
| defaultHandlerActorLevelUp = function ( pActor,nLevel ) | ||||
|      | ||||
|      | ||||
|     SendLevelMail( pActor,nLevel) | ||||
| end | ||||
|  | ||||
| function SendLevelMail(pActor, nLevel) | ||||
|     --邮件 | ||||
|     local mailData = getActorMailData(pActor) | ||||
|     if mailData == nil then | ||||
|         return | ||||
|     end | ||||
|     if mailData.lvMail == nil then | ||||
|         return | ||||
|     end | ||||
|     local Cfg = LevelMailConfig; | ||||
|     if Cfg == nil then | ||||
|         return | ||||
|     end | ||||
|  | ||||
|     local mailCfg = MailIDConfig; | ||||
|     if mailCfg == nil then | ||||
|         return | ||||
|     end  | ||||
|     local nActorId = Actor.getActorId(pActor) | ||||
|     if Cfg[nLevel] then | ||||
|         for _, id in pairs(Cfg[nLevel].idList) do | ||||
|             if not mailData.lvMail[id] then | ||||
|                 if mailCfg[id] and mailCfg[id].isSend then | ||||
|                     if mailCfg[id].attachment then | ||||
|                         SendMail(nActorId, mailCfg[id].title, mailCfg[id].content, mailCfg[id].attachment) | ||||
|                     else | ||||
|                         SendMail(nActorId, mailCfg[id].title, mailCfg[id].content) | ||||
|                     end | ||||
|                     mailData.lvMail[id] = 1 | ||||
|                 end | ||||
|             end | ||||
|         end | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
| function SendLoginMail(pActor) | ||||
|     --邮件 | ||||
|     local mailData = getActorMailData(pActor) | ||||
|     if mailData == nil then | ||||
|         return | ||||
|     end | ||||
|     if mailData.loginMail == nil then | ||||
|         return | ||||
|     end | ||||
|     local day = System.getDaysSinceOpenServer(); | ||||
|     local Cfg = LoginDayMailConfig; | ||||
|     if Cfg == nil then | ||||
|         return | ||||
|     end | ||||
|     local opentime = System.getOpenServerToday(); | ||||
|     local mailCfg = MailIDConfig; | ||||
|     if mailCfg == nil then | ||||
|         return | ||||
|     end  | ||||
|     opentime = opentime - (day -1)*24*3600; | ||||
|     local creattime = Actor.getActorCreateTime(pActor); | ||||
|     if creattime == 0 then | ||||
|         return | ||||
|     end | ||||
|     local nActorId = Actor.getActorId(pActor) | ||||
|     for _, cfg in pairs(Cfg) do | ||||
|         if cfg.day <= day then | ||||
|             --print("opentime.."..opentime) | ||||
|             --print("11111.."..creattime.."..day.."..(opentime +  cfg.day*24*3600) ) | ||||
|             if creattime < (opentime +  cfg.day*24*3600) then | ||||
|                 if mailData.loginMail[cfg.day] == nil then | ||||
|  | ||||
|                    for _, id in pairs(cfg.idList) do | ||||
|                         if mailCfg[id] and mailCfg[id].isSend then | ||||
|                         print("SendLoginMail"..Actor.getName(pActor) .."..id:"..id) | ||||
|                             if mailCfg[id].attachment then | ||||
|                                 SendMail(nActorId, mailCfg[id].title, mailCfg[id].content, mailCfg[id].attachment) | ||||
|                             else | ||||
|                                 SendMail(nActorId, mailCfg[id].title, mailCfg[id].content) | ||||
|                             end | ||||
|                         end | ||||
|                     end | ||||
|                     mailData.loginMail[cfg.day] = 1  | ||||
|                 end | ||||
|             end | ||||
|         end | ||||
|     end | ||||
| end | ||||
|  | ||||
| function getActorMailData(pActor) | ||||
|     if Actor.getEntityType(pActor) ~= enActor then | ||||
|         return nil; | ||||
|     end | ||||
|     local var = Actor.getStaticVar(pActor) | ||||
|     if var.mailData == nil then | ||||
|         var.mailData = {} | ||||
|     end | ||||
|      | ||||
|     if var.mailData.lvMail == nil then | ||||
|         var.mailData.lvMail = {} | ||||
|     end | ||||
|  | ||||
|     if var.mailData.loginMail == nil then | ||||
|         var.mailData.loginMail = {} | ||||
|     end | ||||
|  | ||||
|     return var.mailData; | ||||
| end | ||||
							
								
								
									
										74
									
								
								LogicServer/data/functions/ActorEvent/ActorLoginHandler.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								LogicServer/data/functions/ActorEvent/ActorLoginHandler.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| --人物登录事件(注意:此时部分DB数据可能尚未装载完毕) | ||||
| defaultHandlerPlayerLogin = function (pActor,nFirstLogin) | ||||
|    | ||||
| 	if nFirstLogin and nFirstLogin > 0 then | ||||
| 		 | ||||
| 		if( Actor.isFirstLogin(pActor) ) then   | ||||
|  | ||||
| 		end | ||||
| 	end | ||||
| 	ProcActorData(pActor)  | ||||
|  	ActorEvnetPlayerLoginAfterDie( pActor ) | ||||
|   	loadActorData(pActor)  | ||||
| 	--登录邮件 | ||||
|  | ||||
| 	SendLoginMail(pActor) | ||||
| 	PersonalBoss.OnNewDayArrive(pActor,1); | ||||
|  | ||||
| end | ||||
|  | ||||
| --载入玩家的PK模式数据 | ||||
| function loadPKModeDataFunc(sysarg) | ||||
| 	local var = Actor.getStaticVar( sysarg ) | ||||
| 	pkmode = var.pkmode | ||||
| 	if pkmode == nil then  | ||||
| 	--print("pkmode is nil !!") | ||||
| 	var.pkmode = {} | ||||
| 	pkmode = var.pkmode | ||||
| 		--Actor.setPkMode(sysarg,fpZY)		 | ||||
| 	else	 | ||||
| 	--print("pkmode:"..pkmode[1]) | ||||
| 	if pkmode[1]== nil then pkmode[1] = fpPeaceful end | ||||
| 		if pkmode[1]~= nil then  | ||||
| 			Actor.setPkMode(sysarg,pkmode[1]) | ||||
| 			--print("get:"..Actor.getPkMode(sysarg)) | ||||
| 		end | ||||
| 	end | ||||
| end | ||||
|    | ||||
| --玩家登陆时读取玩家的.[数据参数:玩家的ActorID;] | ||||
| function loadActorData(pActor)  | ||||
| 	local nLast = Actor.getLastLogoutTime(pActor)	--上次下线的时间 | ||||
| 	if (nLast == 0) then | ||||
| 		Actor.setPkMode(pActor,fpPeaceful) | ||||
|   	--else | ||||
| 	--	if (nLast < System.getToday()) then | ||||
| 	--	  Actor.removeQuestNewDay(pActor) | ||||
| 	--	end | ||||
| 	end | ||||
| 	loadPKModeDataFunc(pActor) | ||||
| end | ||||
|  | ||||
| --人物死亡后登录 | ||||
| function ActorEvnetPlayerLoginAfterDie( pActor ) | ||||
| 	if Actor.getIntProperty(pActor,PROP_CREATURE_HP) == 0 then | ||||
| 		Actor.relive(pActor) | ||||
| 		local maxhp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXHP)  | ||||
| 		Actor.changeHp(pActor,maxhp*0.3) | ||||
| 		local actorMp = Actor.getIntProperty(pActor,PROP_CREATURE_MP) | ||||
| 		local maxmp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXMP) | ||||
| 		Actor.changeMp(pActor,-(actorMp-maxmp*0.3))		 | ||||
| 	end | ||||
| end | ||||
|  | ||||
| --处理玩家数据 | ||||
| function ProcActorData(pActor)  | ||||
| 	local lastLogoutTime = Actor.getLastLogoutTime(pActor)	--上次下线的时间 | ||||
| 	if (lastLogoutTime == 0) then							--新注册玩家 | ||||
|  | ||||
| 	else | ||||
| 		if lastLogoutTime < System.getToday() then  	--昨天下线的,已经跨天了 | ||||
| 			 | ||||
| 		end | ||||
| 	end | ||||
| end | ||||
							
								
								
									
										27
									
								
								LogicServer/data/functions/ActorEvent/ActorLogoutHandler.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								LogicServer/data/functions/ActorEvent/ActorLogoutHandler.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| --lua script | ||||
|  | ||||
| --人物登出事件  | ||||
| defaultHandlerPlayerLogout = function (pActor,nActorId) | ||||
|  | ||||
| 	local fbId = Actor.getFubenId(pActor) | ||||
| 	if fbId > 0 then | ||||
| 		 | ||||
| 	end | ||||
| 	SaveData(pActor,Actor.getIntProperty(pActor,PROP_ENTITY_ID)) | ||||
| end | ||||
|  | ||||
| --保存玩家的PK模式数据 | ||||
| function savePKModeDataFunc(pActor,var) | ||||
| 	local pkmode = var.pkmode | ||||
| 	if pkmode == nil then  | ||||
| 		var.pkmode = {} | ||||
| 		pkmode = var.pkmode | ||||
| 	end | ||||
| 	pkmode[1] = Actor.getPkMode(pActor) | ||||
| end | ||||
|   | ||||
| --玩家退出时保存玩家的数据 | ||||
| function SaveData(pActor) | ||||
| 	local var = Actor.getStaticVar( pActor ) | ||||
| 	savePKModeDataFunc(pActor,var)	--玩家的PK模式数据 | ||||
| end | ||||
| @@ -0,0 +1,4 @@ | ||||
| --角色跨天事件 | ||||
| defaultHandleActorNewDay = function (pActor,args) | ||||
| 	 | ||||
| end | ||||
							
								
								
									
										251
									
								
								LogicServer/data/functions/ActorEvent/ActorReliveHandler.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										251
									
								
								LogicServer/data/functions/ActorEvent/ActorReliveHandler.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,251 @@ | ||||
| local campType_Blue = 1  | ||||
| local campType_Red  = 2  | ||||
|  | ||||
| --复活超时 | ||||
| defaultHandlerActorReliveTimeOut = function (pActor,args) | ||||
| 	AutoRelive(pActor) | ||||
| end | ||||
|  | ||||
| --超时自动复活 | ||||
| function AutoRelive(pActor) | ||||
| 	if Actor.getIntProperty(pActor,PROP_CREATURE_HP) ~= 0 then  | ||||
| 		return | ||||
| 	end | ||||
| 	if Actor.hasMapAreaAttri(pActor, aaSafeResurrection) then		--限制10秒复活 | ||||
| 		if(System.getCurrMiniTime() < Actor.getDeadTimeRecent(pActor) + 10)then | ||||
| 			--return | ||||
| 		end | ||||
| 	end | ||||
|  | ||||
| 	--获取当前副本复活配置 | ||||
| 	local pFuben = Actor.getFubenPrt(pActor) | ||||
| 	local fbId = Fuben.getFubenIdByPtr(pFuben) | ||||
| 	local ConfId = (StaticFubens[fbId] and StaticFubens[fbId].reliveConfId) or 1 | ||||
| 	local ReliveConf = ReliveConfig[ConfId] or ReliveConfig[1] | ||||
|  | ||||
| 	--回血回蓝 | ||||
| 	local maxhp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXHP) | ||||
| 	Actor.changeHp(pActor, maxhp * ((ReliveConf.RecoverRatio.hp or 100)/100)) | ||||
| 	local maxmp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXMP) | ||||
| 	Actor.changeMp(pActor, maxmp * ((ReliveConf.RecoverRatio.mp or 100)/100)) | ||||
| 	 | ||||
| 	-- 静态场景安全区复活 | ||||
| 	if ReliveConf.autoType == 1 then | ||||
| 		if Fuben.isFuben(pFuben) then | ||||
| 			Actor.exitFubenAndBackCity(pActor) | ||||
| 		else | ||||
| 			Actor.relive(pActor) | ||||
| 		end | ||||
| 	-- 副本场景安全区复活 | ||||
| 	elseif ReliveConf.autoType == 2 then | ||||
| 		Actor.relive(pActor) | ||||
| 	-- 本图随机复活 | ||||
| 	elseif ReliveConf.autoType == 3 then | ||||
| 		System.telportRandPos(pActor) | ||||
| 	-- 原地复活 | ||||
| 	elseif ReliveConf.autoType == 4 then | ||||
| 	-- 固定点复活 | ||||
| 	elseif ReliveConf.autoType == 5 then | ||||
| 		if ReliveConf.FixedPosi then | ||||
| 			local sceneId = Actor.getSceneId(pActor) | ||||
| 			Actor.enterScene(pActor, sceneId, ReliveConf.FixedPosi.x, ReliveConf.FixedPosi.y) | ||||
| 		else | ||||
| 			Actor.relive(pActor) | ||||
| 		end | ||||
| 	--本方阵营复活 | ||||
| 	elseif ReliveConf.autoType == 6 then | ||||
| 			local cacheData = FubenDispatcher.GetCacheData(pFuben) | ||||
|             if cacheData.atvId ~= nil  then   --全局配置里的复活类型和活动里重新分配阵营配置类型一致。 | ||||
|                 local ActorData = ActivityDispatcher.GetActorData(pActor,cacheData.atvId)               | ||||
|                 if ActorData.curCamp ==nil then return end  | ||||
|                 if ActorData.curCamp == campType_Blue then  | ||||
|                     if ReliveConf.camprevive.nEnterRangeA ~= nil then  | ||||
| 						Actor.enterScene(pActor,unpack(ReliveConf.camprevive.nEnterRangeA)) | ||||
| 					end  | ||||
|                 else  | ||||
|  | ||||
|                     if ReliveConf.camprevive.nEnterRangeB ~= nil  then  | ||||
| 						Actor.enterScene(pActor,unpack(ReliveConf.camprevive.nEnterRangeB)) | ||||
| 					end                      | ||||
|                 end  | ||||
|             else  | ||||
|                 Actor.relive(pActor)    | ||||
|             end | ||||
| 	end | ||||
|  | ||||
| 	--清除复活倒计时 | ||||
| 	Actor.clearReliveTimeOut(pActor) | ||||
| 	Actor.onRelive(pActor) | ||||
| 	--Actor.removeState(pActor, esStateDeath) | ||||
| 	--Actor.updateActorEntityProp(pActor) | ||||
| 	TranRedActorToRedSceen(pActor)	--一定要放在复活的后面,先退出副本再进监狱 | ||||
| end | ||||
|  | ||||
| local ReliveType = | ||||
| { | ||||
| 	PlaceRelive = 1, --原地复活 | ||||
| 	SafeRelive = 2, -- 安全复活 | ||||
| } | ||||
|  | ||||
| local ReliveConsumeType =  | ||||
| { | ||||
| 	item = 1, --消耗道具 | ||||
| 	yb = 2, --消耗元宝 | ||||
| } | ||||
|   | ||||
| local KillerType =   | ||||
| {  | ||||
| 	player = 0,  --玩家 | ||||
| 	monster = 1, --怪物 | ||||
| 	other = 2, --其他 | ||||
| } | ||||
|  | ||||
| --点击确定 复活类型 1原地复活 2安全复活 | ||||
| function GoReliveFunc(pActor, type) | ||||
| 	 | ||||
| 	if Actor.hasMapAreaAttri(pActor, aaNotHereRelive) then		--要判断是否禁止原地复活 | ||||
| 		safeResurrection(pActor) | ||||
| 	end | ||||
|  | ||||
| 	local maxhp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXHP) | ||||
| 	Actor.changeHp(pActor,maxhp) | ||||
|  | ||||
| 	local maxmp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXMP) | ||||
| 	Actor.changeMp(pActor,maxmp) | ||||
|  | ||||
| 	Actor.clearReliveTimeOut(pActor) | ||||
| 	Actor.onRelive(pActor) | ||||
| 	 | ||||
| 	--清除击杀者信息 | ||||
| 	ClearKillerData(pActor) | ||||
|  | ||||
| end | ||||
|  | ||||
| --检测复活消耗 复活类型 1消耗道具 2消耗元宝 | ||||
| function CheckReliveFunc(pActor, nType) | ||||
| 	local nType = tonumber(nType) | ||||
| 	if Actor.getIntProperty(pActor,PROP_CREATURE_HP) == 0 then  | ||||
| 		if nType == ReliveConsumeType.item then | ||||
| 			--if(IsfreePlaceRelive(pActor) == false)then		--免费复活 | ||||
| 				if Actor.getItemCount(pActor,ReliveConfig.item.id,-1,-1) < ReliveConfig.item.count | ||||
| 				or Actor.removeItem(pActor,ReliveConfig.item.id,ReliveConfig.item.count,-1,-1,-1,OldLang.Log.relive0001, ReliveConfig.logId) < ReliveConfig.item.count then | ||||
| 					Actor.messageBox(pActor,0,0,OldLang.Script.relive0001,OldLang.Script.relive0002.."/buyResurrecStone",OldLang.Script.relive0003.."/cancelFunc",nil) | ||||
| 					return | ||||
| 				end | ||||
| 			--end | ||||
| 		elseif nType == ReliveConsumeType.yb then | ||||
| 			--if(IsfreePlaceRelive(pActor) == false)then	--免费复活 | ||||
| 				if (Actor.getIntProperty( pActor, PROP_ACTOR_YUANBAO ) < ReliveConfig.yuanbao) | ||||
| 				or Actor.changeMoney(pActor, mtYuanbao, -ReliveConfig.yuanbao, ReliveConfig.logId, OldLang.Log.relive0002)	== false then  | ||||
| 					return  | ||||
| 				end | ||||
| 			--end | ||||
| 		end | ||||
| 		GoReliveFunc(pActor, nType) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| --红名传送到红名村 | ||||
| function TranRedActorToRedSceen(sysarg,bFlag) | ||||
| 	local pkValue = Actor.getIntProperty(sysarg,PROP_ACTOR_PK_VALUE) | ||||
| 	if pkValue < PkConfig.redName then	--红名 | ||||
| 		return false | ||||
| 	end | ||||
| 	local sceneName = Fuben.getSceneNameById(PkConfig.nSceenId) | ||||
| 	Actor.enterScene(sysarg,unpack(PkConfig.nEnterRange)) | ||||
| 	--System.telportSceneDefaultPoint(sysarg, sceneName) | ||||
| 	if bFlag == true then | ||||
| 		Actor.sendTipmsg(sysarg,Lang.Activity.t00038,2+128) | ||||
| 	end | ||||
| 	return true | ||||
| end | ||||
|  | ||||
| --原地复活 | ||||
| function OnPlaceRelive(pActor)   | ||||
| 	 | ||||
| 	if Actor.hasMapAreaAttri(pActor, aaNotHereRelive) then		--要判断是否禁止原地复活 | ||||
| 		Actor.sendTipmsg(pActor, OldLang.Script.relive0005, ttTipmsgWindow)  | ||||
| 		local nLiveTime = Actor.getReliveTimeOut(pActor) | ||||
| 		return | ||||
| 	end | ||||
|   | ||||
| 	local liveTime = Actor.getReliveTimeOut(pActor) | ||||
| 	local level = Actor.getIntProperty(pActor,PROP_CREATURE_LEVEL) | ||||
| 	if level < ReliveConfig.limitLevel then  | ||||
| 		local tips = string.format(OldLang.Script.relive0006, ReliveConfig.limitLevel)  | ||||
| 		Actor.sendTipmsg(pActor,tips,ttTipmsgWindow)  | ||||
| 		return | ||||
| 	end	 | ||||
|  | ||||
| 	local ItemCount = Actor.getItemCount(pActor,ReliveConfig.item.id,-1,-1) | ||||
| 	local nMoneyCount = Actor.getIntProperty( pActor, PROP_ACTOR_YUANBAO ) | ||||
| 	--itemid为回魂丹的ID | ||||
| 	if (ItemCount < ReliveConfig.item.count and  nMoneyCount < ReliveConfig.yuanbao) then    | ||||
| 		local itemName = Item.getItemName(ReliveConfig.item.id) or  " " | ||||
| 		local tips = string.format(OldLang.Script.relive0004, itemName, ReliveConfig.yuanbao)  | ||||
| 		Actor.sendTipmsg(pActor,tips,ttTipmsgWindow) | ||||
| 		return  | ||||
| 	else | ||||
| 		if Actor.getItemCount(pActor,ReliveConfig.item.id,-1,-1) >= ReliveConfig.item.count then | ||||
| 			CheckReliveFunc(pActor, ReliveConsumeType.item) | ||||
| 		else | ||||
| 			CheckReliveFunc(pActor, ReliveConsumeType.yb) | ||||
| 		end | ||||
| 	end | ||||
| 	local svar = Actor.getStaticVar(pActor) | ||||
| 	if(svar.freePlaceReliveFlag == nil)then | ||||
| 		svar.freePlaceReliveFlag = 0 | ||||
| 	end	 | ||||
| 	svar.freePlaceReliveFlag = svar.freePlaceReliveFlag + 1  | ||||
| end | ||||
|  | ||||
| --安全复活  | ||||
| function safeResurrection(pActor) | ||||
| 	if Actor.getIntProperty(pActor,PROP_CREATURE_HP) ~= 0 then  | ||||
| 		return | ||||
| 	end | ||||
| 	if Actor.hasMapAreaAttri(pActor, aaSafeResurrection) then		--限制10秒复活 | ||||
| 		if(System.getCurrMiniTime() < Actor.getDeadTimeRecent(pActor) + 10)then | ||||
| 			--return | ||||
| 		end | ||||
| 	end | ||||
| 	--回血回蓝 | ||||
| 	local maxhp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXHP) | ||||
| 	Actor.changeHp(pActor, maxhp * ReliveConfig.safeRate) | ||||
|  | ||||
| 	local maxmp = Actor.getIntProperty(pActor,PROP_CREATURE_MAXMP) | ||||
| 	Actor.changeMp(pActor, maxmp * ReliveConfig.safeRate) | ||||
| 	 | ||||
| 	local bInCrossBattle = false | ||||
| 	--在跨服中的处理 | ||||
| 	if System.isCommonServer() == true then | ||||
| 		 | ||||
| 	end | ||||
| 	local fbid  = Actor.getFubenId(pActor) | ||||
| 	local nSceneId = Actor.getSceneId(pActor) | ||||
|  | ||||
| 	--复活 | ||||
| 	Actor.relive(pActor)  | ||||
| 	 | ||||
| 	--清除复活倒计时 | ||||
| 	Actor.clearReliveTimeOut(pActor) | ||||
| 	ClearKillerData(pActor) --清除击杀者信息 | ||||
| 	 | ||||
| 	TranRedActorToRedSceen(pActor)	--一定要放在复活的后面,先退出副本再进监狱 | ||||
| end | ||||
|  | ||||
| --清除击杀者信息 | ||||
| function ClearKillerData(pActor)   | ||||
|  | ||||
| 	local svar = Actor.getStaticVar(pActor) | ||||
| 	local data = svar.killerData	--被击杀者记录被杀信息 | ||||
| 	if not data then  | ||||
| 		svar.killerData = {} | ||||
| 		data = svar.killerData | ||||
| 	end | ||||
| 	data[1] = nil	--击杀者等级 | ||||
| 	data[2] = nil	--击杀者阵营ID | ||||
| 	data[3] = nil 	--击杀者名字 | ||||
| 	data[4] = nil	--击杀者类型  | ||||
| 	data[5] = nil	--被击杀者掉落功勋  | ||||
| end | ||||
| @@ -0,0 +1,5 @@ | ||||
| --提取元宝操作 参数1:提取的元宝数 | ||||
| defaultHandleActorWithDrawGameGold = function (pActor,nArgWithDrawCount) | ||||
|    | ||||
|    | ||||
| end | ||||
| @@ -0,0 +1,7 @@ | ||||
|  | ||||
| BuffRemovedHandlers = {} | ||||
|  | ||||
| -- 角色Buff消失事件 | ||||
| function defaultHandlerBuffRemoved(pActor, buffId) | ||||
| 	 | ||||
| end | ||||
							
								
								
									
										10
									
								
								LogicServer/data/functions/ActorEvent/FuBenHandler.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								LogicServer/data/functions/ActorEvent/FuBenHandler.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| function defaultHandlerEnterFuben(pActor, arg) | ||||
| 	 | ||||
| end | ||||
|  | ||||
| function defaultHandlerExitFuben( pActor, fubenId ) | ||||
| 	local curFbId = Actor.getFubenId(pActor) | ||||
| 	if curFbId ~= fubenId then | ||||
| 		return | ||||
| 	end | ||||
| end | ||||
		Reference in New Issue
	
	Block a user