public EmoteBubble(int emotion, WorldUIAnchor bubbleAnchor, int time = 180) { anchor = bubbleAnchor; emote = emotion; lifeTime = time; lifeTimeStart = time; }
public EmoteBubble(int emotion, WorldUIAnchor bubbleAnchor, int time = 180) { this.anchor = bubbleAnchor; this.emote = emotion; this.lifeTime = time; this.lifeTimeStart = time; }
public static int NewBubble(int emoticon, WorldUIAnchor bubbleAnchor, int time) { EmoteBubble emoteBubble = new EmoteBubble(emoticon, bubbleAnchor, time); emoteBubble.ID = EmoteBubble.AssignNewID(); EmoteBubble.byID[emoteBubble.ID] = emoteBubble; if (Main.netMode == 2) { Tuple<int, int> tuple = EmoteBubble.SerializeNetAnchor(bubbleAnchor); NetMessage.SendData(91, -1, -1, "", emoteBubble.ID, (float)tuple.Item1, (float)tuple.Item2, (float)time, emoticon, 0, 0); } return emoteBubble.ID; }
public static int NewBubble(int emoticon, WorldUIAnchor bubbleAnchor, int time) { EmoteBubble emoteBubble = new EmoteBubble(emoticon, bubbleAnchor, time); emoteBubble.ID = AssignNewID(); byID[emoteBubble.ID] = emoteBubble; if (Main.netMode == 2) { Tuple <int, int> tuple = SerializeNetAnchor(bubbleAnchor); NetMessage.SendData(91, -1, -1, "", emoteBubble.ID, tuple.Item1, tuple.Item2, time, emoticon); } return(emoteBubble.ID); }
public static int NewBubble(int emoticon, WorldUIAnchor bubbleAnchor, int time) { EmoteBubble emoteBubble = new EmoteBubble(emoticon, bubbleAnchor, time); emoteBubble.ID = EmoteBubble.AssignNewID(); EmoteBubble.byID[emoteBubble.ID] = emoteBubble; if (Main.netMode == 2) { Tuple <int, int> tuple = EmoteBubble.SerializeNetAnchor(bubbleAnchor); NetMessage.SendData(91, -1, -1, (NetworkText)null, emoteBubble.ID, (float)tuple.Item1, (float)tuple.Item2, (float)time, emoticon, 0, 0); } return(emoteBubble.ID); }
public static int NewBubbleNPC(WorldUIAnchor bubbleAnchor, int time, WorldUIAnchor other = null) { EmoteBubble emoteBubble = new EmoteBubble(0, bubbleAnchor, time); emoteBubble.ID = EmoteBubble.AssignNewID(); EmoteBubble.byID[emoteBubble.ID] = emoteBubble; emoteBubble.PickNPCEmote(other); if (Main.netMode == 2) { Tuple<int, int> tuple = EmoteBubble.SerializeNetAnchor(bubbleAnchor); NetMessage.SendData((int)PacketTypes.EmoteBubble, -1, -1, "", emoteBubble.ID, (float)tuple.Item1, (float)tuple.Item2, (float)time, emoteBubble.emote, emoteBubble.metadata, 0); } return emoteBubble.ID; }
public static Tuple<int, int> SerializeNetAnchor(WorldUIAnchor anch) { if (anch.type != WorldUIAnchor.AnchorType.Entity) return Tuple.Create<int, int>(0, 0); int num = 0; if (anch.entity is NPC) num = 0; else if (anch.entity is Player) num = 1; else if (anch.entity is Projectile) num = 2; return Tuple.Create<int, int>(num, anch.entity.whoAmI); }
public static int NewBubbleNPC(WorldUIAnchor bubbleAnchor, int time, WorldUIAnchor other = null) { EmoteBubble emoteBubble = new EmoteBubble(0, bubbleAnchor, time); emoteBubble.ID = EmoteBubble.AssignNewID(); EmoteBubble.byID[emoteBubble.ID] = emoteBubble; emoteBubble.PickNPCEmote(other); if (Main.netMode == 2) { Tuple <int, int> tuple = EmoteBubble.SerializeNetAnchor(bubbleAnchor); NetMessage.SendData(91, -1, -1, (NetworkText)null, emoteBubble.ID, (float)tuple.Item1, (float)tuple.Item2, (float)time, emoteBubble.emote, emoteBubble.metadata, 0); } return(emoteBubble.ID); }
public static Tuple <int, int> SerializeNetAnchor(WorldUIAnchor anch) { if (anch.type == WorldUIAnchor.AnchorType.Entity) { int item = 0; if (anch.entity is NPC) { item = 0; } else if (anch.entity is Player) { item = 1; } else if (anch.entity is Projectile) { item = 2; } return(Tuple.Create(item, anch.entity.whoAmI)); } return(Tuple.Create(0, 0)); }
public static Tuple<int, int> SerializeNetAnchor(WorldUIAnchor anch) { WorldUIAnchor.AnchorType type = anch.type; if (type == WorldUIAnchor.AnchorType.Entity) { int item = 0; if (anch.entity is NPC) { item = 0; } else if (anch.entity is Player) { item = 1; } else if (anch.entity is Projectile) { item = 2; } return Tuple.Create<int, int>(item, anch.entity.whoAmI); } return Tuple.Create<int, int>(0, 0); }
public static Tuple <int, int> SerializeNetAnchor(WorldUIAnchor anch) { if (anch.type != WorldUIAnchor.AnchorType.Entity) { return((Tuple <int, int>)Tuple.Create <int, int>((M0)0, (M1)0)); } int num = 0; if (anch.entity is NPC) { num = 0; } else if (anch.entity is Player) { num = 1; } else if (anch.entity is Projectile) { num = 2; } return((Tuple <int, int>)Tuple.Create <int, int>((M0)num, (M1)anch.entity.whoAmI)); }
private void ProbeExceptions(List <int> list, Player plr, WorldUIAnchor other) { NPC entity = (NPC)this.anchor.entity; if (entity.type == 17) { list.Add(80); list.Add(85); list.Add(85); list.Add(85); list.Add(85); } else if (entity.type == 18) { list.Add(73); list.Add(73); list.Add(84); list.Add(75); } else if (entity.type == 19) { if (other != null && ((NPC)other.entity).type == 22) { list.Add(1); list.Add(1); list.Add(93); list.Add(92); } else if (other != null && ((NPC)other.entity).type == 22) { list.Add(1); list.Add(1); list.Add(93); list.Add(92); } else { list.Add(82); list.Add(82); list.Add(85); list.Add(85); list.Add(77); list.Add(93); } } else if (entity.type == 20) { if (list.Contains(121)) { list.Add(121); list.Add(121); } list.Add(14); list.Add(14); } else if (entity.type == 22) { if (!Main.bloodMoon) { if (other != null && ((NPC)other.entity).type == 19) { list.Add(1); list.Add(1); list.Add(93); list.Add(92); } else { list.Add(79); } } if (!Main.dayTime) { list.Add(16); list.Add(16); list.Add(16); } } else if (entity.type == 37) { list.Add(43); list.Add(43); list.Add(43); list.Add(72); list.Add(72); } else if (entity.type == 38) { if (Main.bloodMoon) { list.Add(77); list.Add(77); list.Add(77); list.Add(81); } else { list.Add(77); list.Add(77); list.Add(81); list.Add(81); list.Add(81); list.Add(90); list.Add(90); } } else if (entity.type == 54) { if (Main.bloodMoon) { list.Add(43); list.Add(72); list.Add(1); } else { if (list.Contains(111)) { list.Add(111); } list.Add(17); } } else if (entity.type == 107) { if (other != null && ((NPC)other.entity).type == 124) { list.Remove(111); list.Add(0); list.Add(0); list.Add(0); list.Add(17); list.Add(17); list.Add(86); list.Add(88); list.Add(88); } else { if (list.Contains(111)) { list.Add(111); list.Add(111); list.Add(111); } list.Add(91); list.Add(92); list.Add(91); list.Add(92); } } else if (entity.type == 108) { list.Add(100); list.Add(89); list.Add(11); } if (entity.type == 124) { if (other != null && ((NPC)other.entity).type == 107) { list.Remove(111); list.Add(0); list.Add(0); list.Add(0); list.Add(17); list.Add(17); list.Add(88); list.Add(88); } else { if (list.Contains(109)) { list.Add(109); list.Add(109); list.Add(109); } if (list.Contains(108)) { list.Remove(108); if (Main.hardMode) { list.Add(108); list.Add(108); } else { list.Add(106); list.Add(106); } } list.Add(43); list.Add(2); } } else if (entity.type == 142) { list.Add(32); list.Add(66); list.Add(17); list.Add(15); list.Add(15); } else if (entity.type == 160) { list.Add(10); list.Add(89); list.Add(94); list.Add(8); } else if (entity.type == 178) { list.Add(83); list.Add(83); } else if (entity.type == 207) { list.Add(28); list.Add(95); list.Add(93); } else if (entity.type == 208) { list.Add(94); list.Add(17); list.Add(3); list.Add(77); } else if (entity.type == 209) { list.Add(48); list.Add(83); list.Add(5); list.Add(5); } else if (entity.type == 227) { list.Add(63); list.Add(68); } else if (entity.type == 228) { list.Add(24); list.Add(24); list.Add(95); list.Add(8); } else if (entity.type == 229) { list.Add(93); list.Add(9); list.Add(65); list.Add(120); list.Add(59); } else if (entity.type == 353) { if (list.Contains(104)) { list.Add(104); list.Add(104); } if (list.Contains(111)) { list.Add(111); list.Add(111); } list.Add(67); } else if (entity.type == 368) { list.Add(85); list.Add(7); list.Add(79); } else if (entity.type == 369) { if (Main.bloodMoon) { return; } list.Add(70); list.Add(70); list.Add(76); list.Add(76); list.Add(79); list.Add(79); if ((double)entity.position.Y >= Main.worldSurface) { return; } list.Add(29); } else if (entity.type == 453) { list.Add(72); list.Add(69); list.Add(87); list.Add(3); } else { if (entity.type != 441) { return; } list.Add(100); list.Add(100); list.Add(1); list.Add(1); list.Add(1); list.Add(87); } }
/*private Vector2 GetPosition(out SpriteEffects effect) { switch (this.anchor.type) { case WorldUIAnchor.AnchorType.Entity: effect = ((this.anchor.entity.direction == -1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally); return this.anchor.entity.Top + new Vector2((float)(-(float)this.anchor.entity.direction * this.anchor.entity.width) * 0.75f, 2f) - Main.screenPosition; case WorldUIAnchor.AnchorType.Tile: effect = SpriteEffects.None; return this.anchor.pos - Main.screenPosition + new Vector2(0f, -this.anchor.size.Y / 2f); case WorldUIAnchor.AnchorType.Pos: effect = SpriteEffects.None; return this.anchor.pos - Main.screenPosition; default: effect = SpriteEffects.None; return new Vector2((float)Main.screenWidth, (float)Main.screenHeight) / 2f; } }*/ public void PickNPCEmote(WorldUIAnchor other = null) { Player plr = Main.player[(int)Player.FindClosest(((NPC)this.anchor.entity).Center, 0, 0)]; List<int> list = new List<int>(); bool flag = false; for (int i = 0; i < 200; i++) { if (Main.npc[i].active && Main.npc[i].boss) { flag = true; } } if (!flag) { if (Main.rand.Next(3) == 0) { this.ProbeTownNPCs(list); } if (Main.rand.Next(3) == 0) { this.ProbeEmotions(list); } if (Main.rand.Next(3) == 0) { this.ProbeBiomes(list, plr); } if (Main.rand.Next(2) == 0) { this.ProbeCritters(list); } if (Main.rand.Next(2) == 0) { this.ProbeItems(list, plr); } if (Main.rand.Next(5) == 0) { this.ProbeBosses(list); } if (Main.rand.Next(2) == 0) { this.ProbeDebuffs(list, plr); } if (Main.rand.Next(2) == 0) { this.ProbeEvents(list); } if (Main.rand.Next(2) == 0) { this.ProbeWeather(list, plr); } this.ProbeExceptions(list, plr, other); } else { this.ProbeCombat(list); } if (list.Count > 0) { this.emote = list[Main.rand.Next(list.Count)]; } }
private void ProbeExceptions(List<int> list, Player plr, WorldUIAnchor other) { NPC nPC = (NPC)this.anchor.entity; if (nPC.type == 17) { list.Add(80); list.Add(85); list.Add(85); list.Add(85); list.Add(85); } else if (nPC.type == 18) { list.Add(73); list.Add(73); list.Add(84); list.Add(75); } else if (nPC.type == 19) { if (other != null && ((NPC)other.entity).type == 22) { list.Add(1); list.Add(1); list.Add(93); list.Add(92); } else if (other != null && ((NPC)other.entity).type == 22) { list.Add(1); list.Add(1); list.Add(93); list.Add(92); } else { list.Add(82); list.Add(82); list.Add(85); list.Add(85); list.Add(77); list.Add(93); } } else if (nPC.type == 20) { if (list.Contains(121)) { list.Add(121); list.Add(121); } list.Add(14); list.Add(14); } else if (nPC.type == 22) { if (!Main.bloodMoon) { if (other != null && ((NPC)other.entity).type == 19) { list.Add(1); list.Add(1); list.Add(93); list.Add(92); } else { list.Add(79); } } if (!Main.dayTime) { list.Add(16); list.Add(16); list.Add(16); } } else if (nPC.type == 37) { list.Add(43); list.Add(43); list.Add(43); list.Add(72); list.Add(72); } else if (nPC.type == 38) { if (Main.bloodMoon) { list.Add(77); list.Add(77); list.Add(77); list.Add(81); } else { list.Add(77); list.Add(77); list.Add(81); list.Add(81); list.Add(81); list.Add(90); list.Add(90); } } else if (nPC.type == 54) { if (Main.bloodMoon) { list.Add(43); list.Add(72); list.Add(1); } else { if (list.Contains(111)) { list.Add(111); } list.Add(17); } } else if (nPC.type == 107) { if (other != null && ((NPC)other.entity).type == 124) { list.Remove(111); list.Add(0); list.Add(0); list.Add(0); list.Add(17); list.Add(17); list.Add(86); list.Add(88); list.Add(88); } else { if (list.Contains(111)) { list.Add(111); list.Add(111); list.Add(111); } list.Add(91); list.Add(92); list.Add(91); list.Add(92); } } else if (nPC.type == 108) { list.Add(100); list.Add(89); list.Add(11); } if (nPC.type == 124) { if (other != null && ((NPC)other.entity).type == 107) { list.Remove(111); list.Add(0); list.Add(0); list.Add(0); list.Add(17); list.Add(17); list.Add(88); list.Add(88); return; } if (list.Contains(109)) { list.Add(109); list.Add(109); list.Add(109); } if (list.Contains(108)) { list.Remove(108); if (Main.hardMode) { list.Add(108); list.Add(108); } else { list.Add(106); list.Add(106); } } list.Add(43); list.Add(2); return; } else { if (nPC.type == 142) { list.Add(32); list.Add(66); list.Add(17); list.Add(15); list.Add(15); return; } if (nPC.type == 160) { list.Add(10); list.Add(89); list.Add(94); list.Add(8); return; } if (nPC.type == 178) { list.Add(83); list.Add(83); return; } if (nPC.type == 207) { list.Add(28); list.Add(95); list.Add(93); return; } if (nPC.type == 208) { list.Add(94); list.Add(17); list.Add(3); list.Add(77); return; } if (nPC.type == 209) { list.Add(48); list.Add(83); list.Add(5); list.Add(5); return; } if (nPC.type == 227) { list.Add(63); list.Add(68); return; } if (nPC.type == 228) { list.Add(24); list.Add(24); list.Add(95); list.Add(8); return; } if (nPC.type == 229) { list.Add(93); list.Add(9); list.Add(65); list.Add(120); list.Add(59); return; } if (nPC.type == 353) { if (list.Contains(104)) { list.Add(104); list.Add(104); } if (list.Contains(111)) { list.Add(111); list.Add(111); } list.Add(67); return; } if (nPC.type == 368) { list.Add(85); list.Add(7); list.Add(79); return; } if (nPC.type == 369) { if (!Main.bloodMoon) { list.Add(70); list.Add(70); list.Add(76); list.Add(76); list.Add(79); list.Add(79); if ((double)nPC.position.Y < Main.worldSurface) { list.Add(29); return; } } } else { if (nPC.type == 453) { list.Add(72); list.Add(69); list.Add(87); list.Add(3); return; } if (nPC.type == 441) { list.Add(100); list.Add(100); list.Add(1); list.Add(1); list.Add(1); list.Add(87); } } return; } }
public void PickNPCEmote(WorldUIAnchor other = null) { Player plr = Main.player[(int)Player.FindClosest(this.anchor.entity.Center, 0, 0)]; List <int> list = new List <int>(); bool flag = false; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].boss) { flag = true; } } if (!flag) { if (Main.rand.Next(3) == 0) { this.ProbeTownNPCs(list); } if (Main.rand.Next(3) == 0) { this.ProbeEmotions(list); } if (Main.rand.Next(3) == 0) { this.ProbeBiomes(list, plr); } if (Main.rand.Next(2) == 0) { this.ProbeCritters(list); } if (Main.rand.Next(2) == 0) { this.ProbeItems(list, plr); } if (Main.rand.Next(5) == 0) { this.ProbeBosses(list); } if (Main.rand.Next(2) == 0) { this.ProbeDebuffs(list, plr); } if (Main.rand.Next(2) == 0) { this.ProbeEvents(list); } if (Main.rand.Next(2) == 0) { this.ProbeWeather(list, plr); } this.ProbeExceptions(list, plr, other); } else { this.ProbeCombat(list); } if (list.Count <= 0) { return; } this.emote = list[Main.rand.Next(list.Count)]; }
public void PickNPCEmote(WorldUIAnchor other = null) { Player plr = Main.player[(int)Player.FindClosest(anchor.entity.Center, 0, 0)]; List<int> list = new List<int>(); bool flag = false; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].boss) flag = true; } if (!flag) { if (Main.rand.Next(3) == 0) ProbeTownNPCs(list); if (Main.rand.Next(3) == 0) ProbeEmotions(list); if (Main.rand.Next(3) == 0) ProbeBiomes(list, plr); if (Main.rand.Next(2) == 0) ProbeCritters(list); if (Main.rand.Next(2) == 0) ProbeItems(list, plr); if (Main.rand.Next(5) == 0) ProbeBosses(list); if (Main.rand.Next(2) == 0) ProbeDebuffs(list, plr); if (Main.rand.Next(2) == 0) ProbeEvents(list); if (Main.rand.Next(2) == 0) ProbeWeather(list, plr); ProbeExceptions(list, plr, other); } else ProbeCombat(list); if (list.Count <= 0) return; emote = list[Main.rand.Next(list.Count)]; }