Adding new table for quest.

04/08/2013 07:25 LordGragen.#1
hey guys so since my project is going to have alot of quests i was thiking to make a new table in navicat "quest" insited of saving them in enitity table, just to make it more clean.

but i been having small problems,

last night i coded few stuff which i tested didnt work proper, then thx to sedat we fixed few stuff.

now there is this 1 thing i am stuck not sure what will it be and any kind of help will be nice.

so first here is the questtable.cs

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rise_Of_Medusa.Game;
using SubSonic;

namespace Rise_Of_Medusa.Database
{
    public class QuestTable
    {
        public static void ResetQuests(Game.Entity client)
        {
            MySqlCommand Do = new MySqlCommand(MySqlCommandType.UPDATE);
            Do.Update("quest").Set("StoneFindingQuest", 0).Where("EntityName", client.Name).Execute();

        }
        public static void FinishQuest(Game.Entity client)
        {
            MySqlCommand Do = new MySqlCommand(MySqlCommandType.UPDATE);
            Do.Update("quest").Set("StoneFindingQuest", 1).Where("EntityName", client.Name).Execute();

        }
    }
}
so everytime a person is done with the quest it will add 1 inside of the navicat, but since my quests can be done 1 time a day i added a timer which will reset all the quests every 24 hours.


program.cs

Code:
#region Quest Reset
                            if (DateTime.Now.Hour == 03 && DateTime.Now.Minute >= 00)
                            {
                                Database.QuestTable.ResetQuests(client.Entity);

                            }
                            #endregion
and here is when they done the quest how it send the 1 to navicat.


here is the last part of the npc

Code:
 case 2:
                                            {
                                                if (client.Inventory.Contains(729306, 1))
                                                {
                                                    client.Inventory.DeleteItem(729306, 1);

                                                    Database.QuestTable.FinishQuest(client.Entity);
                                                    client.Entity.Money += 10000000;
                                                    dialog.Text("Nice you did it.");

                                                }
                                            }
                                            break;
navicat part

[Only registered and activated users can see links. Click Here To Register...]


but somehow when the quest is done its not saving the 1, its not sending anything to the database. any help will be grateful.

#request close

problem solve
04/08/2013 21:57 shadowman123#2
Surely it wont add anyvalue ...
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rise_Of_Medusa.Game;
using SubSonic;

namespace 
Rise_Of_Medusa.Database
{
    public class 
QuestTable
    
{
        public static 
void ResetQuests(Game.Entity client)
        {
            
MySqlCommand Do = new MySqlCommand(MySqlCommandType.UPDATE);
            Do.
Update("quest").Set("StoneFindingQuest"0).Where("EntityName"client.Name).Execute();

        }
        public static 
void FinishQuest(Game.Entity client)
        {
            
MySqlCommand Do = new MySqlCommand(MySqlCommandType.UPDATE);
            Do.
Update("quest").Set("StoneFindingQuest"1).Where("EntityName"client.Name).Execute();

        }
    }

u havent made Insert Function .. Set Method is used to update The inserted value inside the database and since u havent inserted any value so it wont work ... btw u need to load the quest table everytime the player login