public override void OnPlayerLeave(ObjPlayer player) { base.OnPlayerLeave(player); //恢复满血满蓝 if (player.IsDead()) { player.Relive(); } else { player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax)); player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax)); } var campId = player.GetCamp(); if (campId == -1) { player.SetCamp(0); return; } var camp = Camps[campId]; camp.Players.Remove(player); player.SetCamp(0); CoroutineFactory.NewCoroutine(PlayerLeave, player).MoveNext(); }
private void PlayerRelive(ObjPlayer player) { var campId = player.GetCamp(); player.SetPosition(Camps[campId].RelivePos); player.Relive(); }
public override void OnPlayerEnterOver(ObjPlayer player) { base.OnPlayerEnterOver(player); if (player.GetCamp() == -1) { KickPlayer(player.ObjId); return; } //如果是守城方,加buff if (player.GetCamp() == DefenderCampId) { foreach (var buffId in DefenderBuffs) { for (int i = 0, imax = buffId.Value; i < imax; i++) { player.AddBuff(buffId.Key, 1, player); } } } // if (State == eDungeonState.WillStart) // { // var t = GetTriggerTime(eDungeonTimerType.WaitStart); // var param = (int) (t - DateTime.Now).TotalSeconds; // param = param << 1; // param += 1; // player.Proxy.NotifyBattleReminder(19, Utils.WrapDictionaryId(41015), param); // } var delta = startTime - DateTime.Now; if (delta.TotalSeconds > 0) { player.Proxy.NotifyCommonCountdown((int)delta.TotalSeconds); } }
public override void OnPlayerEnter(ObjPlayer player) { base.OnPlayerEnter(player); if (player.GetCamp() == -1) { return; } NotifyAllianceWarNpcData(new List <ulong> { player.ObjId }); CoroutineFactory.NewCoroutine(PlayerEnter, player).MoveNext(); }
private int GetPlayerSide(ObjPlayer player) { var side = player.GetCamp() - CampBegin; return(side >= 0 ? side : -1); }
public IEnumerator RespawnGuard(Coroutine co, ObjPlayer player, int index, AsyncReturnValue <ErrorCodes> err) { if (player.GetCamp() != DefenderCampId) { err.Value = ErrorCodes.Error_JurisdictionNotEnough; yield break; } if (GuardReliveCount >= StaticVariable.AllianceWarGuardRespawnMaxCount) { err.Value = ErrorCodes.Error_GuardRespawnExceed; yield break; } var guard = Guards[index]; if (!guard.IsDead()) { NotifyAllianceWarNpcData(new List <ulong> { player.ObjId }); err.Value = ErrorCodes.Error_GuardNotDie; yield break; } //扣钱 var cost = Table.GetSkillUpgrading(73000).GetSkillUpgradingValue(GuardReliveCount); var msg = SceneServer.Instance.LogicAgent.DeleteItem(player.ObjId, (int)eResourcesType.DiamondRes, cost, (int)eDeleteItemType.FuHuoShouWei); yield return(msg.SendAndWaitUntilDone(co)); if (msg.State != MessageState.Reply) { err.Value = ErrorCodes.Unknow; yield break; } var errCode = (ErrorCodes)msg.ErrorCode; if (errCode != ErrorCodes.OK) { err.Value = errCode; yield break; } err.Value = ErrorCodes.OK; var npc = CreateSceneNpc(index + GuardSceneNpcId0, Vector2.Zero, NpcLevel); Guards[index] = npc; ++GuardReliveCount; GuardState.Items[index] = 0; NotifyAllianceWarNpcDataToAllPlayer(); // var idx = MapNpcRecords.FindIndex(r => r.NpcID == npc.TypeId); if (idx != -1) { var info = MapNpcInfo.Data[idx]; info.Alive = true; } //发通告 var args = new List <string>(); args.Add(player.GetName()); var content = Utils.WrapDictionaryId(300930, args); PushActionToAllPlayer(p => { p.Proxy.NotifyBattleReminder(14, content, 1); }); }