Project_WL/Assets/Script/DropItem/DropItem.cs

155 lines
5.6 KiB
C#
Raw Normal View History

2024-12-15 01:39:39 +00:00
using CodeStage.AntiCheat.ObscuredTypes;
using System.Collections;
2025-06-28 00:28:41 +00:00
using System.Collections.Generic;
2024-12-15 01:39:39 +00:00
using UnityEngine;
public class DropItem : ProjectileBase
{
public Collider m_Collider;
ObscuredInt _itemid;
int m_itemid
{
get { return _itemid; }
set { _itemid = value; _itemid.RandomizeCryptoKey(); }
}
ObscuredInt _itemamount;
int m_itemamount
{
get { return _itemamount; }
set { _itemamount = value; _itemamount.RandomizeCryptoKey(); }
}
2024-12-15 01:39:39 +00:00
int m_Magnet;
float MagnetUpTime = 0f;
Vector3 v3_MagnetUP;
private void Update()
{
switch (m_Magnet)
{
case 1:
if (MyValue.MyPC.IsDead())
m_Magnet = 0;
else
{
MagnetUpTime += Time.deltaTime * 2f;
transform.position = Vector3.MoveTowards(transform.position, v3_MagnetUP, Time.deltaTime * m_ProjecTileData.Speed);
2024-12-15 01:39:39 +00:00
if (MagnetUpTime >= 1f)
{
MagnetUpTime = 0f;
m_Magnet = 2;
m_ProjecTileData.Speed = 15f;
2024-12-15 01:39:39 +00:00
}
}
break;
case 2:
if (MyValue.MyPC.IsDead())
m_Magnet = 0;
else
{
m_ProjecTileData.Speed += Time.deltaTime * 2f;
transform.position = Vector3.MoveTowards(transform.position, MyValue.MyPC.Get_Center_position(), Time.deltaTime * m_ProjecTileData.Speed);
2024-12-15 01:39:39 +00:00
}
break;
}
}
public void Set(int itemid, int amount, Vector3 startpos)
2024-12-15 01:39:39 +00:00
{
gameObject.SetActive(true);
m_itemid = itemid;
m_itemamount = amount;
2025-03-06 06:15:45 +00:00
Vector3 targetpos = startpos;
2024-12-15 01:39:39 +00:00
switch (m_itemid)
2024-12-15 01:39:39 +00:00
{
2025-03-06 06:15:45 +00:00
case 2:
startpos += Vector3.up * 0.25f;
targetpos = DSUtil.Get_RandomPos_onNavMesh(startpos, 2f, 3f);
targetpos += Vector3.up * 0.25f;
break;
2024-12-15 01:39:39 +00:00
}
[WL-813f] 전리품 연출 + 드랍률 (#813) CombatEvents.Killed 구독 → 드랍 산포(0.6~1.2 m · 등급별 튀는 높이 0.35+0.08/등급) · 등급 4 이상 빔(보유 FX_LootDrop_Blue/Purple/Gold) + s015_GoldPowerUp · 자동 줍기 반경 1.5 m(원본 자석 상태기를 리플렉션으로 켜기만) · 보스 3~5 · 엘리트 1~2 폭발 드랍(RandomBag 재추첨 · 빈손이면 골드 25%). 값은 전부 WLLootSettings.asset(C45) · 동시 빔은 EffectBudget.Heavy 등록. 원본 수정 = DropItem.cs 2줄(Set 산포 훅 · ItemTouch 획득 통지 훅) 뿐. Actor.cs · MobActor.cs · DropItemInfo.cs · Assets/WL/Combat/Core/** 0줄. 데이터(S): RandomBag.json 새 백 8130001 5행(총 드랍 20.95% · 기준서 15~25%) · MonsterAppear.json 813e 존 6행(813001~813005 · 813010)의 n_DropReward 만 새 백으로 · 나머지 46행 · RandomBag 기존 197행 바이트 무변경. ⚠ butler.xlsm 동기화 필요. 검증: 게이트 PASS(oneshot 1.4분 · error CS 0 / resident up_to_date · 콘솔 error 0) · 에디트 모드 프로브(AgentScripts/WL813f_Probe.cs · 덤프 WL813f_PROBE.txt): 산포 1000회 0.601~1.199 m · 폭발 2000회 boss 3~5 · elite 1~2 · normal 0 · 가짜 Killed 3건 구독 동작 · 자석 리플렉션 OK(0→1 · 중복 방지) · 줍기 경계 1.49 in / 1.51 out / 착지 전 제외 · 빔 4건 → Heavy 상한 2 스폰 · 2 스킵 → CleanupAll 후 슬롯 0 · C8(RuntimeDisabled) 시 산포/빔/획득/폭발 전부 0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-08 16:19:48 +00:00
WL.Combat.Loot.LootBurst.OnDropSpawn(this, m_itemid, m_itemamount, ref startpos, ref targetpos); // WL-813f 산포 훅(꺼지면 원본 그대로)
m_Collider.enabled = false;
2024-12-15 01:39:39 +00:00
StartCoroutine(Co_Move_Split(() =>
{
m_Collider.enabled = true;
2024-12-15 01:39:39 +00:00
if (m_Magnet == 0)
{
var sdata = ServerInfo.Ins.m_ServerData;
// TODO 정인호 : 컨텐츠에서 자석 기능이 있었는 데 어떻게 될 지 모르니 일단 주석처리
//if (InGameInfo.Ins.Get_CurStageData().Chapter > 100)
//{
// var costume16 = sdata.PC.Get_Value(16); // 코스튬 16
// if (costume16 > 0f && Vector3.Distance(transform.position, MyValue.MyPC.Get_position()) <= costume16)
// {
// m_Magnet = 1;
// v3_MagnetUP = transform.position + Vector3.up * 3f;
// m_ProjectTileData.Speed = 5f;
// }
//}
}
2025-03-06 06:15:45 +00:00
}, startpos, targetpos));
StartCoroutine(Co_Rotation_Y());
StartCoroutine(Co_Off(20f));
2024-12-15 01:39:39 +00:00
}
public bool ItemTouch(Actor touchActor)
2024-12-15 01:39:39 +00:00
{
if (gameObject.activeInHierarchy && touchActor)
2024-12-15 01:39:39 +00:00
{
2025-03-07 23:45:34 +00:00
if (touchActor.IsRole(eRole.PC) || touchActor.IsRole(eRole.Worker))
2024-12-15 01:39:39 +00:00
{
var sdata = ServerInfo.Ins.m_ServerData;
var statdata = touchActor.Get_StatInfo();
2024-12-15 01:39:39 +00:00
2025-03-06 07:47:57 +00:00
if (MyValue.MyChoiceMapData.Get_MapData().e_Dungeon == eDungeon.d4_Wave)
{
DungeonInfo.Ins.Add_WaveScore(1); // TODO 정인호 : 웨이브 점수
DungeonInfo.Ins.Add_WaveGold(10); // TODO 정인호 : 웨이브 골드
}
else
{
if (m_itemid == 2)
{
m_itemamount += (int)statdata.Get_Stat(eStat.GOLD_INCREASE);
m_itemamount += (int)(m_itemamount *
(statdata.Get_Stat(eStat.GOLD_Multiplier) + statdata.Get_Stat(eStat.Battle_GOLD_Multiplier)));
2025-03-07 02:08:02 +00:00
var GoldDropRandomRange = table_GlobalValue.Ins.Get_Float("GoldDropRandomRange");
var mingold = m_itemamount - (int)(m_itemamount * GoldDropRandomRange);
var maxgold = m_itemamount + (int)(m_itemamount * GoldDropRandomRange);
m_itemamount = Random.Range(mingold, maxgold);
2025-03-06 07:47:57 +00:00
}
sdata.Add_Item(m_itemid, _itemamount);
2025-06-28 00:28:41 +00:00
DropItemInfo.Ins.m_StageDropData.Add_Item(_itemid, m_itemamount);
2025-03-06 07:47:57 +00:00
}
[WL-813f] 전리품 연출 + 드랍률 (#813) CombatEvents.Killed 구독 → 드랍 산포(0.6~1.2 m · 등급별 튀는 높이 0.35+0.08/등급) · 등급 4 이상 빔(보유 FX_LootDrop_Blue/Purple/Gold) + s015_GoldPowerUp · 자동 줍기 반경 1.5 m(원본 자석 상태기를 리플렉션으로 켜기만) · 보스 3~5 · 엘리트 1~2 폭발 드랍(RandomBag 재추첨 · 빈손이면 골드 25%). 값은 전부 WLLootSettings.asset(C45) · 동시 빔은 EffectBudget.Heavy 등록. 원본 수정 = DropItem.cs 2줄(Set 산포 훅 · ItemTouch 획득 통지 훅) 뿐. Actor.cs · MobActor.cs · DropItemInfo.cs · Assets/WL/Combat/Core/** 0줄. 데이터(S): RandomBag.json 새 백 8130001 5행(총 드랍 20.95% · 기준서 15~25%) · MonsterAppear.json 813e 존 6행(813001~813005 · 813010)의 n_DropReward 만 새 백으로 · 나머지 46행 · RandomBag 기존 197행 바이트 무변경. ⚠ butler.xlsm 동기화 필요. 검증: 게이트 PASS(oneshot 1.4분 · error CS 0 / resident up_to_date · 콘솔 error 0) · 에디트 모드 프로브(AgentScripts/WL813f_Probe.cs · 덤프 WL813f_PROBE.txt): 산포 1000회 0.601~1.199 m · 폭발 2000회 boss 3~5 · elite 1~2 · normal 0 · 가짜 Killed 3건 구독 동작 · 자석 리플렉션 OK(0→1 · 중복 방지) · 줍기 경계 1.49 in / 1.51 out / 착지 전 제외 · 빔 4건 → Heavy 상한 2 스폰 · 2 스킵 → CleanupAll 후 슬롯 0 · C8(RuntimeDisabled) 시 산포/빔/획득/폭발 전부 0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-08 16:19:48 +00:00
WL.Combat.Loot.LootBurst.OnDropPicked(this, m_itemid, m_itemamount, touchActor); // WL-813f 획득 통지 훅(813g 토스트 소스)
InGameInfo.Ins.Show_Effect("Effect_GetCoin", transform.position);
gameObject.SetActive(false);
//NewGameUI.Ins.m_GuideQuestUI.Add_GuideQuest(ePurpose.GetDropItem);
return true;
2024-12-15 01:39:39 +00:00
}
}
return false;
}
public override bool ProcessCollider(Collider other, bool Off_byHit = true, bool noDmg = false)
2024-12-15 01:39:39 +00:00
{
return ItemTouch(other.GetComponent<Actor>());
2024-12-15 01:39:39 +00:00
}
IEnumerator Co_Rotation_Y()
{
float t = 0f;
while (true)
{
2025-03-06 06:15:45 +00:00
t += Time.deltaTime * 30f;
2024-12-15 01:39:39 +00:00
t = Mathf.Repeat(t, 359.9f);
transform.eulerAngles = new Vector3(0f, t, 0f);
2024-12-15 01:39:39 +00:00
yield return null;
}
}
}