saltyhotdog / BattletechIssueTracker

Public issue tracker to communicate with modders and HBS.
MIT License
6 stars 0 forks source link

Conversation Action AddBattleTechFloat Adds Int and not Float #24

Open CWolfs opened 6 years ago

CWolfs commented 6 years ago

Describe the problem

The conversation action method AddBattleTechFloat in BattleTech.cs actually adds an int instead of a float. This means the method is broken.

Provide an example of the code where the problem occurs

Any conversation that will use the action AddBattleTechFloat would not work correctly. The float would be truncated to an int.

Provide an example of your proposed solution

In the AddBattleTechFloat method the following lines should be changed.

float num2 = (float)env.ToInt(inputs[2]);

should be

float num2 = env.ToFloat(inputs[2]);

and

statCollection.ModifyStat<float>("Conversation.Event", 0, statName, StatCollection.StatOperation.Int_Add, num2, -1, true);

should be

statCollection.ModifyStat<float>("Conversation.Event", 0, statName, StatCollection.StatOperation.Float_Add, num2, -1, true);