Creating an NRaas project Interaction refuses to replace

Talk nerdy to us here.
User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » January 25th, 2014, 7:39 pm

Ok so I'll just focus on that. And yes that's the first thing I noticed, there are 2 methods with the same name, one is static and the other not, because EA likes it when it's confusing XD

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » January 25th, 2014, 7:52 pm

I found this :

<!-- ws:start:WikiTextCodeRule:0:
<pre class="text">// Sims3.Gameplay.Objects.Electronics.Phone<br/>public InteractionDefinition GetSendWooHootyTextFromRelationPanelDefinition(IMiniSimDescription simToText)<br/>{<br/> return new Phone.SendWooHootyTextFromRelationPanel.Definition(simToText);<br/>}</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">// Sims3.Gameplay.Objects.Electronics.Phone
public InteractionDefinition GetSendWooHootyTextFromRelationPanelDefinition(IMiniSimDescription simToText)
{
return new Phone.SendWooHootyTextFromRelationPanel.Definition(simToText);
}</pre>


It looks like it's not being used anywhere, which makes me wonder why they bothered, at least that's what ILSpy tells me. This could be a problem if EA decides to start using it, but it won't be cos they'll never do such a thing at this point. I just wanted to point it out in case my ILSpy is lying and it is in fact being used somewhere. I'll keep digging anyway

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » January 25th, 2014, 8:04 pm

Is there a particular reason you're inheriting from Call.CallDefinition instead of SendWoohootyText.Definition, in SendWoohootyTextEx?

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7596
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » January 25th, 2014, 8:18 pm

Hmm. I believe it wouldn't work unless I inherited from there. I've juggled the code a hundred times and reloaded the game, I don't recall unfortunately. It's how SendWooHootyText's definition is setup as well. Don't quote me on that though. That bit works fine. It's just getting past the relation panel that I am stuck at.

GetSendWooHootyTextFromRelationPanelDefinition is being used in the function that generates in the menu for the relation panel. (You can find it in Twallan's RelationshipPanel \ RelationshipPanelSpace \ SimDescriptionEx.cs)

It calls

<!-- ws:start:WikiTextCodeRule:0:
<pre class="text">interactions.Add(new InteractionObjectPair(activePhone.GetSendWooHootyTextFromRelationPanelDefinition(ths), activePhone));</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">interactions.Add(new InteractionObjectPair(activePhone.GetSendWooHootyTextFromRelationPanelDefinition(ths), activePhone));</pre>


which I tried replacing with

<!-- ws:start:WikiTextCodeRule:1:
<pre class="text">if (!Common.AssemblyCheck.IsInstalled(&quot;NRaasWoohooer&quot;))<br/> {<br/> interactions.Add(new InteractionObjectPair(activePhone.GetSendWooHootyTextFromRelationPanelDefinition(ths), activePhone));<br/> }<br/> else<br/> { <br/> Type WooHooty = Type.GetType(&quot;NRaas.WoohooerSpace.SendWooHootyTextFromRelationPanelEx.Definition&quot;);<br/> if (WooHooty != null)<br/> { <br/> object instance = Activator.CreateInstance(WooHooty, new object[] { ths });<br/> interactions.Add(new InteractionObjectPair(instance as InteractionDefinition, activePhone));<br/> }<br/> }</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">if (!Common.AssemblyCheck.IsInstalled("NRaasWoohooer"))
{
interactions.Add(new InteractionObjectPair(activePhone.GetSendWooHootyTextFromRelationPanelDefinition(ths), activePhone));
}
else
{
Type WooHooty = Type.GetType("NRaas.WoohooerSpace.SendWooHootyTextFromRelationPanelEx.Definition");
if (WooHooty != null)
{
object instance = Activator.CreateInstance(WooHooty, new object[] { ths });
interactions.Add(new InteractionObjectPair(instance as InteractionDefinition, activePhone));
}
}</pre>


and it still didn't work. It's not the route I really want to go as that would require two mods.

I didn't try replacing the GetSendWooHootyTextFromRelationPanelDefinition though. It doesn't have a singleton so I'm not sure that would work either. I assume that's why this is failing in the first place as that function is calling new, the replacement just goes out the window. :/

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7596
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » January 25th, 2014, 8:22 pm

Heh. I forgot the 'interactions' part of the namespace there. That's probably why that didn't work. Duh. Either way I'd like to keep it in one mod. Even if I have to yank the EA interaction out and inject a new one... which admittedly I am not sure how to do considering this seems to generate a new instance every time that menu is called. Perhaps I am attempting the impossible and will just have to settle for clicking the sim/phone.

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » January 25th, 2014, 8:26 pm

Ahhh, RelationshipPanel, I was reading "SendBlaBlaBlaPanel" instead, that's why I was confused :P

I guess this needs a deep immersion into it and right now the bed is the only thing I'd like to deeply immerse myself into, so that goes for tomorrow. My brain has background processing, it'll keep working on it while sleeping and hopefully provide me with solutions :)

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7596
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » January 25th, 2014, 9:11 pm

It does require deep immersion. I've been immersed in it for a week and a half and it still isn't obeying. EA really didn't intend for the texting to be extended in any fashion. That coding is so messy and derives from like 7 classes. It's been a headache to say the least. Cheers for any guidance your background processing provides. :)

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » January 26th, 2014, 10:51 am

Right, first thing first, to retrieve the method from Woohooer, you need to use Common.MethodStore. That one caches all the methods from the assemblies so they can be invoked or retrieved from a list. Remember the ErrorTrap ExternalLogger code? Make a method to get the new Definition in Woohooer :

<!-- ws:start:WikiTextCodeRule:0:
<pre class="text">public static InteractionDefinition GetSendWooHootyTextFromRelationPanelDefinitionEx()<br/>{<br/> return....<br/>}</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">public static InteractionDefinition GetSendWooHootyTextFromRelationPanelDefinitionEx()
{
return....
}</pre>


Then, from RelationshipPanel retrieve this method using the aforementioned technique. Why this? Because then you won't have to worry about RelationshipPanel anymore and just focus on Woohoer, cos if you change the singleton or the definition, you won't need to change it in RelationshipPanel too everytime.
This was the result of background processing, as for the rest, still working on it :)

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » January 26th, 2014, 11:02 am

P.S. I forgot to specify that MethodStore is for keeping it, so it doesn't have to go with Reflection everytime. Or you could keep a static Singleton somewhere in RelationshipPanel with the definition from Woohooer, whichever you find nicer :)

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7596
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » January 26th, 2014, 11:25 am

Hmm. Interesting. I had not looked into Common.MethodStore. So I would have to require RelationshipPanel then? Editing RelationshipPanel was something I was playing with in case I couldn't figure out a way to override the method without needing to go there. Such is probably impossible though?

Post Reply