//HELP how to make a delegate here?//notice public void OnOpen(Humanoid user, bool hold) { if (hold) { return; } if (user.GetHoverName() == m_ownerName) { var quest = QuestManager.instance.GetQuest(m_id); if (quest != null) { //upd should select in base? yes!!!!!!!!! QuestProcesser.Create(quest).Finish(); return; } //upd giveup without destroy? } string n = string.Format("Hey you found the chest belong to <color=yellow><b>{0}</b></color>", m_ownerName); //trans DBG.InfoCT(n); }
public static void HackingRuneStones() { Transform t = PrefabManager.Root.transform; var a = ZoneSystem.instance.m_locations; foreach (var item in rstones) { foreach (var item2 in a) { if (item2.m_prefabName == item) { t = item2.m_location.gameObject.transform; } } var go = Instantiate(ZNetScene.instance.GetPrefab("Fighter1" + "Spawner"), t.position, Quaternion.identity, t); go.name = "Fighter1" + "Spawner"; var rnd = go.AddComponent <RandomSpawn>(); rnd.m_chanceToSpawn = 90; DBG.blogWarning("hacking " + item); } }
public static void UnRegister() { var odb = ObjectDB.instance; var zns = ZNetScene.instance; var m_itemByHash = Traverse.Create(odb).Field <Dictionary <int, GameObject> >("m_itemByHash").Value; var m_namedPrefabs = Traverse.Create(ZNetScene.instance).Field <Dictionary <int, GameObject> >("m_namedPrefabs").Value; odb.m_items.RemoveList <int, GameObject>(odbRegList); m_itemByHash.RemoveList <int, GameObject>(odbRegList); zns.m_prefabs.RemoveList <int, GameObject>(odbRegList); m_namedPrefabs.RemoveList <int, GameObject>(odbRegList); zns.m_prefabs.RemoveList <int, GameObject>(znsRegList); m_namedPrefabs.RemoveList <int, GameObject>(znsRegList); foreach (var item in OdinSE.SElist.Values) { odb.m_StatusEffects.Remove(item); } isRegistered = false; m_instance.isLoaded = false; DBG.blogWarning("UnRegister all list"); }
public static GameObject Place(Vector3 pos, string p_id, string p_owner, int p_key, Quaternion rot, bool sphy = true) { GameObject chest; chest = Instantiate(ZNetScene.instance.GetPrefab("LegacyChest" + (p_key + 1).ToString()), pos, rot, OdinPlus.PrefabParent.transform); var lc = chest.GetComponent <LegacyChest>(); lc.Placing = true; lc.m_id = p_id; lc.m_sphy = sphy; lc.m_ownerName = p_owner; if (!sphy) { DestroyImmediate(chest.GetComponent <StaticPhysics>()); } DBG.blogWarning("Placed Chest at " + pos); chest.transform.SetParent(OdinPlus.Root.transform); return(chest); }
public void CreateRandomQuest() { QuestType[] a = new QuestType[] { QuestType.Treasure }; switch (CheckKey()) { case 0: a = new QuestType[] { QuestType.Search, QuestType.Treasure }; break; case 1: a = new QuestType[] { QuestType.Treasure, QuestType.Dungeon, QuestType.Search }; break; case 2: a = new QuestType[] { QuestType.Treasure, QuestType.Hunt, QuestType.Dungeon, QuestType.Search }; break; case 3: a = new QuestType[] { QuestType.Treasure, QuestType.Dungeon, QuestType.Hunt, QuestType.Search }; break; case 4: a = new QuestType[] { QuestType.Treasure, QuestType.Dungeon, QuestType.Hunt, QuestType.Search }; break; case 5: a = new QuestType[] { QuestType.Treasure, QuestType.Dungeon, QuestType.Hunt, QuestType.Search }; break; } int l = a.Length; if (1f.RollDice() < 0.1) { CreateQuest(QuestType.Search); return; } DBG.blogWarning("Dice Rolled"); instance.CreateQuest(a[l.RollDice()]); }
public void OnDeath() { if (Player.GetClosestPlayer(transform.position, 100).GetHoverName() == m_ownerName) { QuestManager.instance.GetQuest(ID).Finish(); } else { if (m_ownerName == "") { } else { string n = string.Format("Hey you found the chest belong to <color=yellow><b>{0}</b></color>", m_ownerName); //trans DBG.InfoCT(n); } } Tweakers.ValSpawn("vfx_GodExplosion", transform.position); var r = Instantiate(ZNetScene.instance.GetPrefab("OdinLegacy"), transform.localPosition, Quaternion.identity); r.GetComponent <ItemDrop>().m_itemData.m_quality = Key; r.GetComponent <ItemDrop>().m_itemData.m_stack = Level; }
public static void loadOdinData(string name) { DBG.blogWarning("Starting loding data"); if (DevTool.DisableSaving) { OdinPlus.m_instance.isLoaded = true; return; } #region Serial string file = Path.Combine(Application.persistentDataPath, (name + ".odinplus")); if (!File.Exists(@file)) { OdinPlus.m_instance.isLoaded = true; Credits = 100; DBG.blogWarning("Profile not exists:" + name); return; } FileStream fileStream = new FileStream(@file, FileMode.Open, FileAccess.Read); //BinaryFormatter formatter = new BinaryFormatter(); //Data = (DataTable)formatter.Deserialize(fileStream); BinaryReader binaryReader = new BinaryReader(fileStream); var str = binaryReader.ReadString(); Data = JsonConvert.DeserializeObject <DataTable>(str); fileStream.Close(); #endregion Serial #region Load Credits = Data.Credits; QuestManager.instance.Load(); LocationManager.BlackList = Data.BlackList; LocationManager.RemoveBlackList(); #endregion Load OdinPlus.m_instance.isLoaded = true; DBG.blogWarning("OdinDataLoaded:" + name); }
private static void CreateTrollPrefab(string name) { if (zns.GetPrefab(name) == null) { DBG.blogWarning("can't find the prefab zns :" + name); return; } var go = Instantiate(zns.GetPrefab(name), Root.transform); go.name = name + "Pet"; Tameable tame; if (!go.TryGetComponent <Tameable>(out tame)) { tame = go.AddComponent <Tameable>(); } go.AddComponent <PetTroll>(); var hd = go.GetComponent <Humanoid>(); var mai = go.GetComponent <MonsterAI>(); DestroyImmediate(go.GetComponent <CharacterDrop>()); hd.m_name = hd.m_name + " Pet"; //trans hd.m_faction = Character.Faction.Players; mai.m_consumeItems.Clear(); SetColor(go); if (hd.m_randomSets.Length > 1) { hd.m_randomSets = hd.m_randomSets.Skip(hd.m_randomSets.Length - 1).ToArray(); } PetList.Add(name + "Pet", go); return; }
private void Awake() { Plugin.logger = base.Logger; CFG_ItemSellValue = base.Config.Bind <string>("Config", "ItemSellValue", "TrophyBlob:20;TrophyBoar:5;TrophyBonemass:50;TrophyDeathsquito:20;TrophyDeer:5;TrophyDragonQueen:50;TrophyDraugr:20;TrophyDraugrElite:30;TrophyDraugrFem:20;TrophyEikthyr:50;TrophyFenring:30;TrophyForestTroll:30;TrophyFrostTroll:20;TrophyGoblin:20;TrophyGoblinBrute:30;TrophyGoblinKing:50;TrophyGoblinShaman:20;TrophyGreydwarf:5;TrophyGreydwarfBrute:15;TrophyGreydwarfShaman:15;TrophyHatchling:20;TrophyLeech:15;TrophyLox:20;TrophyNeck:5;TrophySerpent:30;TrophySGolem:30;TrophySkeleton:10;TrophySkeletonPoison:30;TrophySurtling:20;TrophyTheElder:50;TrophyWolf:20;TrophyWraith:30;AncientSeed:5;BoneFragments:1;Chitin:5;WitheredBone:10;DragonEgg:40;GoblinTotem:20;OdinLegacy:20"); Plugin.nexusID = base.Config.Bind <int>("General", "NexusID", 798, "Nexus mod ID for updates"); KS_SecondInteractkey = base.Config.Bind <KeyboardShortcut>("1Hotkeys", "Second Interact key", new KeyboardShortcut(KeyCode.G)); CFG_OdinPosition = base.Config.Bind <Vector3>("2Server set only", "Odin position", Vector3.zero); CFG_ForceOdinPosition = base.Config.Bind <bool>("2Server set only", "Force Odin Position", false); RegRPC = (Action)ReigsterRpc; _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null); //-- init here OdinPlusRoot = new GameObject("OdinPlus"); OdinPlusRoot.AddComponent <ResourceAssetManager>(); OdinPlusRoot.AddComponent <OdinPlus>(); //notice Debug OdinPlusRoot.AddComponent <DevTool>(); DontDestroyOnLoad(OdinPlusRoot); DBG.blogInfo("OdinPlus Loadded"); }
public static void RPC_ServerSetGlobalKey(long sender, string gkey) { ZoneSystem.instance.SetGlobalKey(gkey); DBG.blogWarning("Server set Global key: " + gkey); }
public static void RequestResetGlobalKey() { ZRoutedRpc.instance.InvokeRoutedRPC("RPC_ServerResetGlobalKey"); DBG.blogWarning("Client Request Reset Global key"); }
public static void RPC_ServerResetGlobalKey(long sender) { ZoneSystem.instance.ResetGlobalKeys(); DBG.blogWarning("Client Request Reset Global key"); }
void DevWindow(int WindowID) { GUI.DragWindow(new Rect(0, 0, 4000, 20)); GUILayout.Width(400); GUILayout.Height(50); GUILayout.Label("welcom to use odin plus debug tool", style); var player = Player.m_localPlayer; if (player != null) { var val = ZoneSystem.instance.GetZone(player.transform.position); GUILayout.Label("Zone: " + val.ToString(), style); GUILayout.Label("Location: " + (player.transform.position).ToString(), style); if (ZNet.instance != null) { if (ZNet.instance.IsServer()) { var dic = Traverse.Create(ZoneSystem.instance).Field <Dictionary <Vector2i, ZoneSystem.LocationInstance> >("m_locationInstances").Value; if (dic.ContainsKey(val)) { string locName = dic[ZoneSystem.instance.GetZone(player.transform.position)].m_location.m_prefabName; GUILayout.Label(locName, style); } else { GUILayout.Label("No location here", style); } } GUILayout.BeginHorizontal(); lname = GUILayout.TextField(lname, 40); if (GUILayout.Button("FindLoctaion")) { Game.instance.DiscoverClosestLocation(lname, player.transform.position, lname, 0); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Key0")) { DBG.blogWarning("Reseting global keys"); RequestResetGlobalKey(); } if (GUILayout.Button("Key1")) { RequestResetGlobalKey(); RequestSetGlobalKey("defeated_eikthyr"); } if (GUILayout.Button("Key2")) { RequestResetGlobalKey(); RequestSetGlobalKey("defeated_eikthyr"); RequestSetGlobalKey("defeated_gdking"); } if (GUILayout.Button("Key3")) { RequestResetGlobalKey(); RequestSetGlobalKey("defeated_eikthyr"); RequestSetGlobalKey("defeated_gdking"); RequestSetGlobalKey("defeated_bonemass"); } if (GUILayout.Button("Key4")) { RequestResetGlobalKey(); RequestSetGlobalKey("defeated_eikthyr"); RequestSetGlobalKey("defeated_gdking"); RequestSetGlobalKey("defeated_bonemass"); RequestSetGlobalKey("defeated_moder"); } if (GUILayout.Button("Key5")) { RequestResetGlobalKey(); RequestSetGlobalKey("defeated_eikthyr"); RequestSetGlobalKey("defeated_gdking"); RequestSetGlobalKey("defeated_bonemass"); RequestSetGlobalKey("defeated_moder"); RequestSetGlobalKey("defeated_goblinking"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("FreeCam")) { GameCamera.instance.ToggleFreeFly(); } foreach (QuestType item in Enum.GetValues(typeof(QuestType))) { if (GUILayout.Button(item.ToString())) { QuestManager.instance.CreateQuest(item); } } GUILayout.EndHorizontal(); } } }
public static void RequestSetGlobalKey(string gkey) { ZRoutedRpc.instance.InvokeRoutedRPC("RPC_ServerSetGlobalKey", new object[] { gkey }); DBG.blogWarning("Client Request Set Global key :" + gkey); }
public static void RPC_ReceiveServerFOP(long sender, bool result) { DBG.blogWarning("Client Got FOP:" + result); Plugin.Set_FOP = result; }
public static void Clear() { TrollIns = null; DBG.blogInfo("PetList Clear"); }
public static void RPC_SendServerFOP(long sender) { ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RPC_ReceiveServerFOP", new object[] { Plugin.CFG_ForceOdinPosition.Value }); DBG.blogWarning("Server Sent FOP:" + Plugin.CFG_ForceOdinPosition.Value); }
private void RPC_SetStartPos(long sender, Vector3 pos) { DBG.blogWarning("client got odin postion " + pos); NpcManager.Root.transform.localPosition = pos; }
public static void ReigsterRpc() { DBG.blogWarning("Starting reg rpc"); }
private void ShowWaitError() { DBG.InfoCT("There maybe something wrong with the server,please try again later"); }
void OnDestroyed() { PetManager.Indicator.SetActive(false); PetManager.TrollIns = null; DBG.InfoCT(Localization.instance.Localize(this.GetComponent <Humanoid>().m_name + " died")); //trans }